LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 10-03-2005, 08:13 AM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Rep: Reputation: 31
how to find out how big is a directory


Hi!

I would like to know how to check out how big is a directory using the command line. When I use
Code:
ls -lh
, I donīt get the whole stuff but only 4,0k for any directory no matter what is inside.

Thanks for your help.

Xpucto

Last edited by xpucto; 10-03-2005 at 08:14 AM.
 
Old 10-03-2005, 08:16 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,397

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
you want du, Disk Usage i assume... "du -h /some/dir/some/where/"
 
Old 10-03-2005, 08:19 AM   #3
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Well, using du gives me all the file separatly. But I would like to know how big it is in total. If I have 5 files of 5MB each in my /home directory, I would like to get 25MB as a result for "how big is /home".

Xpucto
 
Old 10-03-2005, 08:26 AM   #4
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
Oups... sorry, I didnīt see that at the end there is also the sum of all files.

Thanks.
 
Old 10-03-2005, 08:36 AM   #5
SkyEye
Member
 
Registered: Sep 2005
Location: Sri Lanka
Distribution: Fedora (workstations), CentOS (servers), Arch, Mint, Ubuntu, and a few more.
Posts: 441

Rep: Reputation: 40
Yes, alternatively you can use this to get size in MBs or GBs
Code:
du -h <path_of_the_dir> | tail -1
(1 is number one not letter L and replase <path_of_the_dir> with the path of the directory you want)

Last edited by SkyEye; 10-03-2005 at 08:38 AM.
 
Old 10-03-2005, 06:36 PM   #6
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 51
Code:
du -sh /directory/
will give the total size of that directory and all files and subfolders within it. See man du.
 
Old 10-04-2005, 01:54 AM   #7
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,604

Rep: Reputation: 47
other tools out there: kdirstat and xdu

(I know you said command line, but I am sure if somebody reads this
thread, then they might be interested by alternative solutions)

Last edited by Emmanuel_uk; 10-04-2005 at 02:15 AM.
 
Old 10-04-2005, 02:12 AM   #8
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 51
Or just right-click->Properties on the folder in KDE if you want the GUI way
 
  


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
How do I find what directory is on what partition? mijohnst Linux - Newbie 2 10-05-2005 04:16 PM
How to find a string in a directory? iclinux Linux - Newbie 2 07-02-2005 08:20 AM
find size of directory naijaguy Linux - Newbie 3 03-04-2005 11:11 AM
Big Problem with overfilled directory davesbedroom Linux - Software 11 01-19-2005 03:38 PM
Cant find home directory? BajaNick Linux - Software 2 07-28-2003 09:04 PM


All times are GMT -5. The time now is 04:57 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