LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-15-2011, 11:11 AM   #1
daweefolk
Member
 
Registered: Sep 2009
Distribution: debian
Posts: 76

Rep: Reputation: 15
Restricting 'du' to child directories only?


I'm trying to write a script that uses the 'du' command to make essentially a text-based filelight type program.
It should scan the current directory for the file's sizes and display them in order largest to smallest (or vice versa). The user should be able to go throughout the file tree and see child directories scanned for the sizes as they're accessed.
I just need to know one more thing- how can I restrict the displayed results to the current working directory? would a grep for the output of pwd suffice? just getting some thoughts before i try and possibly dig myself a hole.
 
Old 02-15-2011, 01:31 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,770

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
You can use the ls command, with options for long listing, recursive search, sort by file size, current working directory: ls -lRS $PWD

You can then pipe the results through awk to show only the fields of interest in the output.

Last edited by bigrigdriver; 02-15-2011 at 01:33 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting users to two directories Centos 5.3 thebomb Linux - Server 1 02-16-2010 01:01 AM
Difference between Child THREAD and Child PROCESS whho Linux - Newbie 10 08-02-2009 07:24 PM
How to kill a Child and all its subsequent child process in C shayer009 Programming 3 12-04-2007 12:40 AM
chroot jail with rssh / restricting users to individual directories rob_xx17 Linux - Security 3 01-23-2006 03:28 AM
Killing a child process from another child marri Programming 6 10-01-2004 07:08 PM


All times are GMT -5. The time now is 02:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration