.4The numbers in the left column of the output represent the file size of each file and directory that the specified directory path contains, in human-readable format.
Note:Due to the number of files and directories in the /var directory, this example only shows partial output from the du utility.
.5Examine the output and determine which directories use the most space.
Delete selected files and directories.
You can delete individual files within a directory and individual directories. To do this, perform the following steps:
.1Change to the directories that contain the most disk space.
.2Examine the size of each file in the directory. To do this, run the du -h * command.
.3The output will resemble the following example:
Note:The following example displays the output for the /var/www/html directory.
4.0K 400.shtml
4.0K 401.shtml
4.0K 403.shtml
4.0K 404.shtml
4.0K 413.shtml
4.0K 500.shtml
12K cp_errordocument.shtml
4.0K index.html
.4Either delete the files or save the most recent entries.
To save the most recent entries, run the following commands:
Note:In these commands, filename represents the file to delete, and filename.new represents the file to which to save the most recent entries.
tail-5000 filename > filename.new
mv filename.new filename
sync
To delete the files, run the following command:
cat /dev/null > filename
Restart the service.
After you delete the files and directories, restart the service that created the file. To do this, follow the directions in our How to Restart Services documentation.