Linux du -sh Command Explained

du -sh is a Linux command used to calculate the size of a file or directory. It stands for disk usage – summary.

  1. “du” stands for “disk usage” and is used to view disk usage.
  2. The option “s” (optional) stands for “summary,” which is used to display summarized information without showing detailed information of subdirectories.
  3. The option “-h” stands for “human-readable”, displaying the size of files or directories in a format that is easy for humans to understand, such as KB, MB, or GB.

Therefore, the du -sh command will calculate the total size of the given file or directory and display the result in a readable format. Here is an example:

du -sh /path/to/directory

The output may be:

2.5G   /path/to/directory

The total size of the specified directory is 2.5GB, denoted as 2.5G.

bannerAds