Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to: get the total size (in bytes) of a folder/directory 2

Status
Not open for further replies.

zyrag

IS-IT--Management
Dec 4, 2002
252
PH
In windows, one way to get the the directory size is by right-clicking on the dir then choose properties. In aix (ascii terminal), what is the equivalent command to get the directory size in bytes?

thanks,
 
Hi,

Go to that particular directory and use du -k . to get the directory size and file size in bytes.

regards

arvind
 
use "df" command

or to check physical disk, use "lspv" command.

(you may try man pages for parameter details).

 
If you want the summary size of a directory with all subdirectories and files in it, do
du -sk <path>
 
thanks, is the result already in Megabytes?
 
but it doesn't seem to be equal to the result i got when i add manually the size in each file inside the directory? why? do i have to multiply it with 1024 or the PP size?
 
du -sk will include any recursive directories also.
 
du -k calculates the number of blocks used for each file. Standard AIX filesystems use a 4k block size so the smallest a file (w/ data) will be is 4k. Generally the only place this isn't true is on /home (by default it uses a 512 byte fragment).

That being the case du will always tell you how much the file is physically taking up in the file system.

If you want the actual number of bytes you could always try:

du -ks <dir> | awk ' { printf &quot;%d %s\n&quot;, $1 * 1024, $2 }'
 
thanks usige. and for that, you got a star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top