LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-25-2011, 01:31 AM   #1
silver_distro
LQ Newbie
 
Registered: Oct 2011
Posts: 6

Rep: Reputation: Disabled
Help with du command


I need to find find the memory usage of all the folders individually (and not the files) inside a given folder. How do I do that.
I checked with 'du' command, but could not find any option to suit me requirement.
Please help me out here
 
Old 11-25-2011, 01:46 AM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 210Reputation: 210Reputation: 210
Try some combination of du and find:

Code:
find . -type d -exec du {} \;
http://linux.die.net/man/1/find
http://linux.die.net/man/1/du
 
1 members found this post helpful.
Old 11-25-2011, 01:48 AM   #3
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Try:http://www.oreillynet.com/linux/cmd/

and in the terminal
Code:
man du
Regards
 
Old 11-25-2011, 02:10 AM   #4
silver_distro
LQ Newbie
 
Registered: Oct 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
As per my needs...

du --si --max-depth=1
is more helpful than

find . -type d -exec du {} \;

But how do I filter out the folders I do not need.?

I apologize for incorrectly framing the question, I meant that I needed the disk usage of some of the folders within a specific folder. I also need to compare it with total disk space so as to find the available space.

Last edited by silver_distro; 11-25-2011 at 02:14 AM.
 
Old 11-28-2011, 05:18 PM   #5
moonshadow
LQ Newbie
 
Registered: Jan 2009
Location: Sweden
Distribution: openSUSE, Slackware
Posts: 9

Rep: Reputation: 0
It sounds to me like it is the -s option for du you want to use. It will summarize the disk usage for the folders without writing out all the files. Depending on your needs you can specify particular folders to check like so
Code:
du -s folder1 folder2
or
Code:
du -s somewhere/*
to get the results for all directories under somewhere/. Feel free to include the --si option too if you don't need exact numbers. It makes it a bit easier on the eye
 
Old 11-28-2011, 05:45 PM   #6
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Centos6.3/Debian
Posts: 2,175
Blog Entries: 1

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Have you tried
Code:
du -hs *
Code:
du -ch | grep total

Last edited by spiky0011; 11-28-2011 at 05:48 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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 12:21 PM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 02:31 PM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 03:14 AM
busybox command works, same command within script says permission denied jeroenv Linux - Newbie 2 01-17-2009 03:58 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 07:30 PM


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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration