du [ -a | -s ] [ -k ] [ -m ] [ -g ][ -l ] [ -r ] [ -x ] [ File ... ]
The du command displays the number of blocks used for files. If the File parameter specified is actually a directory, all files within the directory are reported on. If no File parameter is provided, the du command uses the files in the current directory.
If the File parameter is a directory, then the number of blocks reported is the sum of blocks allocated for the files in the directory and the blocks allocated for the directory itself.
Specifying the -a flag reports the number of blocks in individual files. Whether the -a flag is used or not, individual files specified by the File parameter are always listed.
Specifying the -s flag reports the total blocks for all specified files or all files in a directory.
The block count includes indirect blocks of each file. Block count is calculated in 512-byte units independent of the cluster size used by the system. Specifying the -k flag calculates the block count in 1024-byte units.
If all or any two of the -k, -m and -g flags are specified, the last one specified takes effect. The output of the disk usage with the flags -m and -g would be rounded off to the nearest second decimal digit.
This command returns the following exit values:
0 | Successful completion. |
>0 | An error occurred. |
du /home/fran
This displays the number of disk blocks in the /home/fran directory and each of its subdirectories.
du -k /home/franThis displays the number of 1024-byte disk blocks in the /home/fran directory and each of its subdirectories.
du -m /home/franThis displays the number of MB disk blocks rounded off to nearest 2nd decimal digit in the /home/fran directory and each of its subdirectories.
du -g /home/franThis displays the number of GB disk blocks rounded off to nearest 2nd decimal digit in the /home/fran directory and each of its subdirectories.
du -a /home/franThis displays the number of disk blocks contained in each file and subdirectory of the /home/fran directory. The number beside a directory is the disk usage of that directory tree. The number beside a regular file is the disk usage of that file alone.
du -s /home/franThe -s flag instructs the du command to display only the sum total disk usage of the /home/fran directory and the files it contains. By default, the du command displays an error message if it cannot read a file or directory.
/usr/bin/du | Contains the du command. |
The df command.
The Directory Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices explains working with directories and path names.
The Files Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices provides information on working with files.