LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Command folder size (https://www.linuxquestions.org/questions/linux-newbie-8/command-folder-size-309248/)

Ataraxos 04-03-2005 11:24 AM

Command folder size
 
I am searching a command which shows a folder size.
Thanx :Pengy:

brainiac 04-03-2005 11:30 AM

ls -l will show size and attributes.

Ataraxos 04-03-2005 11:35 AM

Quote:

Originally posted by brainiac
ls -l will show size and attributes.
ls -l
total 8
drwxr-xr-x 2 cmfans ftponly 4096 Aug 9 2004 botdir/
drwxr-xr-x 9 cmfans ftponly 4096 Apr 3 13:14 www/

where tells me the folder size? :confused:

Greyweather 04-03-2005 11:38 AM

ls -s

If you want it to show the size in megabytes when the files are that big use:
ls -sh

Ataraxos 04-03-2005 11:42 AM

Quote:

Originally posted by Greyweather
ls -s

If you want it to show the size in megabytes when the files are that big use:
ls -sh

ls -s --block-size=M
total 1M
1M botdir/ 1M www/

:confused:

Greyweather 04-03-2005 11:44 AM

So in your case, use

ls -sh botdir/
ls -sh www/

The first thing it'll output is the total size of the directory ("folder" in Linux-speak), then the size of each file.

Ataraxos 04-03-2005 11:47 AM

Quote:

Originally posted by Greyweather
So in your case, use

ls -sh botdir/
ls -sh www/

It returns me

ls -sh www/
total 34M
... (and the size of each file)

34MB is the size of files inside www but don't calculate the size of subfolders which are inside in www.

Any ideas? :confused:

Greyweather 04-03-2005 12:03 PM

du -sh botdir/
du -sh www/

This is what I should have told you to use from the start, but I just found out about it. ^_^;;

Ataraxos 04-03-2005 12:09 PM

Thanx dude worked!!!

:Pengy:


All times are GMT -5. The time now is 05:06 PM.