Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-25-2011, 01:31 AM   #1
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
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:

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

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380

and in the terminal
man du
Old 11-25-2011, 02:10 AM   #4
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
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
du -s folder1 folder2
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
Senior Member
Registered: Jan 2011
Distribution: /LFS/Debian
Posts: 2,380
Blog Entries: 1

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

Last edited by spiky0011; 11-28-2011 at 05:48 PM.


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:21 PM.

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