LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 08-20-2009, 04:59 PM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Rep: Reputation: 46
command to do a ll with total folder size for each


I have a lot of folders where i need to report how big each folder is (all its files and subfolders). Right now I just do a ll to see all the folder names, then go into each one and do a du -ch | grep total.
 
Old 08-20-2009, 05:01 PM   #2
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
Have you tried `du -s` on either * or a list of all your directories?

Just so you know, ll isn't a valid command in most places. It's an alias defined in your .bashrc or somewhere, probably to `ls -l`.
 
Old 08-20-2009, 06:03 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
ll is ls -l, sorry for the confusion

how would i do a du -s for say all folders within a /data? I tried and apparently didn't do it right.
 
Old 08-20-2009, 06:17 PM   #4
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
`du -s /data/*` should give you a single line for each thing in /data/. If you need to match only the directories, that's a little trickier... maybe write a shell script that takes the output of ls and prints each thing only if it's a directory? If you're in the mood to switch shells (or install a new one and write a script for it), zsh has much more advanced globbing that can take care of this - I can get the effect you want with `du -sh *(/)`.
 
Old 08-21-2009, 10:01 AM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
Oh, that worked perfectly! I did a du -sh /data/* and that gave me exactly what i was looking for. i threw the h in there since all the folders are pretty big, makes it easier to read.
 
Old 08-21-2009, 04:15 PM   #6
karamarisan
Member
 
Registered: Jul 2009
Location: Illinois, US
Distribution: Fedora 11
Posts: 374

Rep: Reputation: 55
I only left it out to focus on the important option - I never run du without -h, myself. Glad you got what you wanted, and good luck in the future.
 
  


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
Any fast way to know the total file size under a folder gsbarry Linux - General 15 06-22-2010 09:42 AM
Getting the size of the folder without using the tar command Berris.Oliver Linux - Newbie 1 03-02-2009 10:22 PM
Command folder size Ataraxos Linux - Newbie 8 04-03-2005 01:09 PM
How to check the size of a folder from command prompt skoivisto Linux - General 2 07-31-2004 03:41 PM
Command to find total file size satimis Linux - Newbie 1 01-22-2004 12:19 PM


All times are GMT -5. The time now is 06:16 AM.

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