LinuxQuestions.org
Visit Jeremy's Blog.
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 08-20-2009, 03:59 PM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
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, 04: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, 05:03 PM   #3
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
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, 05: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, 09:01 AM   #5
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
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, 03: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



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

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

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