Unix Disk Space Usage Command
Disk usage, du is a good Unix command to check on the disk space usage in Unix platform. To list down the files and directories usage in kB, refer the Unix command below: -
UNIX> du -sk * 52704 oracle 4312 tmp 3064 var 480 core 96 log 48 database 40 applications 24 temp 20 dbf 20 opt -s was instead of the default output, report only the total sum for each of the specified files. -k was write the files size in units of 1024 bytes, rather than the default 512-byte units.
UNIX> du -sh * 4.0K oracle.xml 20K wordpress.php 8.0K sap.xml 4.0K index.php 4.0K space.sh 4.0K tools.php 4.0K datafiles.dbf 4.0K indexfiles.dbf -s was instead of the default output, report only the total sum for each of the specified files. -h option provides "Human-readable" output.
If you need to sort the file according to the size, you may use the sorting function in Unix together with the du command as below: -
UNIX> du -sk .[A-z]* *|sort -n 24 php.ini 48 sitemap.xml 480 smartoptimizer 3064 wp-admin 4312 wp-includes
To show the largest ten files or directories in the current directory, you can use the Unix command as below: -
UNIX> du -s * | sort -nr | head
Leave a Comment


Recent Comments