LinuxQuestions.org
Help answer threads with 0 replies.
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
 
Search this Thread
Old 02-26-2007, 08:07 PM   #1
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 199

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, 08: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, 08:29 PM   #3
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 199

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

Rep: Reputation: 118Reputation: 118
du -sh is also useful. For example, du -sh / will list the total space used by each file/directory in /.
 
Old 02-26-2007, 08: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, 09:05 PM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

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

Rep: Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079
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, 09:51 PM   #8
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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


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 04:42 PM
Apache Directory Listing Of NFS Mount, cannot view directory list via apache luqmana Linux - Networking 2 12-19-2005 07:03 AM
Not enough space for root directory on a drive with 50g free space??? auoq Linux - Newbie 1 10-13-2004 01:44 PM
how do you determine amount of free space? elamigo2004 Linux - Software 3 04-17-2004 08:31 PM
After removing another hard drive, system sees incorrect amount of free space cellphone Linux - General 5 09-28-2003 08:29 PM


All times are GMT -5. The time now is 06:05 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration