Forrest logo
back to the du tool


du: List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size).
$ du -h ${path-to-directory}
try on your machine

The command "du -h ${path-to-directory}" is used to display the disk usage of a directory in a human-readable format.

Here's a breakdown of the command:

  • "du" stands for "disk usage", and it is a command-line utility in Unix-like operating systems used to estimate file and directory space usage.
  • "-h" is an option that tells the "du" command to display the disk usage in a human-readable format, such as "K" for kilobytes, "M" for megabytes, or "G" for gigabytes. Without this option, the sizes would be displayed in bytes.
  • "${path-to-directory}" is a placeholder that represents the specific directory path you want to check the disk usage for. You need to replace this placeholder with the actual path to the directory you want to analyze.

Putting it all together, the command "du -h ${path-to-directory}" will provide you with the disk usage of the specified directory in a more readable format, making it easier to understand how much space it occupies on your disk.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the du tool