LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 02-26-2007, 07:07 PM   #1
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 195

Rep: Reputation: 30
List Amount of Space Taken Up by Each Directory?


I want to know how much space is taken up by each directory and it's contents. I've tried "ls -la" but that just lists folders as taking up 4096 bytes.
 
Old 02-26-2007, 07:23 PM   #2
puntjuh
Member
 
Registered: Apr 2006
Location: holland
Distribution: Gentoo / debian / suse / mint
Posts: 558

Rep: Reputation: 41
do in console either as root or normal user.

du -c -h /usr (change the /usr to whatever map you wanna know size from)


-c is for total
-h is for human readable, so it reports as MB's GB's and KB's.

Just wait for the command to finish and then it'll give total size.
 
Old 02-26-2007, 07:29 PM   #3
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 195

Original Poster
Rep: Reputation: 30
What if I want to list only the size of the current-level directories?
 
Old 02-26-2007, 07:30 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
du -sh is also useful. For example, du -sh / will list the total space used by each file/directory in /.
 
Old 02-26-2007, 07:42 PM   #5
puntjuh
Member
 
Registered: Apr 2006
Location: holland
Distribution: Gentoo / debian / suse / mint
Posts: 558

Rep: Reputation: 41
Matir, i think u mean:

tux / # du -ch --max-depth=1 /
16K /lost+found
4.7M /boot
8.0K /.links
8.1M /bin
221M /opt
25M /lib
4.6M /root
425M /var
4.4M /sbin
24K /mnt
608K /dev
18M /tmp
13M /proc
9.9M /etc
4.2G /usr
9.7G /home
0 /sys
4.0K /media
15G /
15G total

Leaving --max-depth=1 away will result in a big output with all files listed..
 
Old 02-26-2007, 08:05 PM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
Sorry, I meant "du -sh /*". Or, for current directory files "du -sh ./*".
 
Old 02-26-2007, 08:48 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,801

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
Mmmm - I've never been a fan of "human readable" like this. I'm usually looking for the space hog, and reverse sort.
 
Old 02-26-2007, 08:51 PM   #8
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,506

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by syg00
Mmmm - I've never been a fan of "human readable" like this. I'm usually looking for the space hog, and reverse sort.
Drop the -h.
 
  


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make most amount of Linux users in least amount of time studpenguin General 24 02-02-2007 03:42 PM
Apache Directory Listing Of NFS Mount, cannot view directory list via apache luqmana Linux - Networking 2 12-19-2005 06:03 AM
Not enough space for root directory on a drive with 50g free space??? auoq Linux - Newbie 1 10-13-2004 12:44 PM
how do you determine amount of free space? elamigo2004 Linux - Software 3 04-17-2004 07:31 PM
After removing another hard drive, system sees incorrect amount of free space cellphone Linux - General 5 09-28-2003 07:29 PM


All times are GMT -5. The time now is 04:53 AM.

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