Size of a directory

Hi,

It would be of great help if anyone can tell me what is the command for getting the size of a directory.

Thx a lot in advance

Minaz

minazk,

Do you mean the size of a file system, or do you mean how much space is being used by the files located in a particular directory?

If it's the first, take a look at the "df" command ("man df"). If it's the latter, take a look at the "du" command ("man du").

Biker
Systems/Network Administrator
LiveFire Labs - Hands-On Technical e-Learning

Thx biker...

What I meant so say was ..I wanted to know how much space all the files are consuming in a particular directory. I did check "du".
I got my answer but still am a little confused. Can u please help me out ??

Thanx a lot

First, tell us what OS you are running. Some OSs have their own commands that are proprietary and give more info.

What are your questions about used and unused file space on a filesystem?

please post back.... :wink:

Hey ,

I got what i wanted... just was a little confused.
But now i'm clear about it. Thanx anyways !!

Thx & Regards,
Minaz

Confused about what?

if you do a search for all of my posts in the past i think month or 2 i posted a script for exactly what your asking as it was already asked by someone else.

(dont worry i only post like 1 or 2x a day.)

Hey Thanx a lot... that solved a lot of my queries...

Thanx,
Minaz

It's great when your downloading a file or set of files to use the command:

user@host(/)$ watch du -ak | grep ".ext"

heh.

(where .ext is the extension of the file you wish to monitor or even a full filename)

this full command is nice, because it let's you know the progress of iso downloads or whatever.

sorry heh. that last command i gave would be invalid.

uhm you would actually have to use a while loop to show download progress. ( this works for both directories and files alike )

while true ; do clear ; du -ak | grep "pattern" ; sleep 2s ; done

heh that'll do it.