6/17/09

Solaris df, du, ls commands

Solaris df command

New df, du, and ls Options

The df, du, and ls commands have a new h option for displaying disk usage and file or file system sizes that are easy to understand.

The default form of the df command displays file system size in blocks (512 bytes). The df output, in kilobytes, follows:

$ df -k / /usr
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s0 192056 94788 78063 55% /
/dev/dsk/c0t0d0s6 1982988 829966 1093533 44% /usr

The same file system sizes displayed in powers of 1024 follows:

$ df -h / /usr
Filesystem size used avail capacity Mounted on
/dev/dsk/c0t0d0s0 188M 93M 76M 55% /
/dev/dsk/c0t0d0s6 1.9G 811M 1.0G 44% /usr

The default form of the du command displays disk space in blocks (512 bytes). The du output, in blocks, follows:

% du -s k*
100 kadmin
98 kadmin.local
98 kdb5_util
90 keyserv
10 killall

The same disk space displayed in powers of 1024 follows:

% du -h k*
50K kadmin
49K kadmin.local
49K kdb5_util
45K keyserv
5K killall

The default form of the ls -l command displays file size in bytes. Use the ls -lh command to display file size in powers of 1024:

% ls -lh k
-r-xr-xr-x 1 root bin 49K Nov 30 03:32 kadmin
-r-xr-xr-x 1 root bin 49K Nov 30 03:32 kadmin.local
-r-xr-xr-x 1 root bin 49K Nov 30 03:32 kdb5_util
-r-xr-xr-x 1 root sys 44K Nov 25 04:37 keyserv
-r-xr-xr-x 1 root bin 4.3K Nov 25 04:36 killall

No comments: