LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 12: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, 12:46 AM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
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, 12:48 AM   #3
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

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

and in the terminal
Code:
man du
Regards
 
Old 11-25-2011, 01: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 01:14 AM.
 
Old 11-28-2011, 04: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, 04:45 PM   #6
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

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

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


Reply



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 11:21 AM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 01: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 02:14 AM
busybox command works, same command within script says permission denied jeroenv Linux - Newbie 2 01-17-2009 02:58 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 06:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:50 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
Open Source Consulting | Domain Registration