Getting older, not necessarily wiser!
The du command comes from Disk Usage, and displays the amount of space taken up by a directory or file. The basic command has been around since the mid 1980’s.
Depending on command options, du provides the user with file space allocated to to the contents of the current or specified directory. The du command will recursively scan the current directory to estimate space used.
The syntax for the du command is:
du [options][file]
The specific information displayed will depend on the options selected when using du. If a file or directory argument is given, du returns the estimated size.
The du command with no options will list every file and directory within the selected path.
Note the output of du will be affected by the user permissions along the path.
Basic usage of the command du is as follows, with no options.
du
This will print out the sizes and names of all the files and directorates within the current working directory.
Using the -s option will list the estimated sizes of the top level files and directorates.
In the following example du will list all the top level directories in the /home folder.
du /home
In this example du provides a summery of the size of the /home folder.
du -s /home
There are a few options that most users will use with any regularity. They are as follows.
This is a quick overview of the du command to determine file and folder usage. For a complete list of options refer tot he man page for your specific distribution.
Add New Comment