Display the total size of a directory in a human-readable format

To display the total disk usage of a folder and its subdirectories in human-readable format, you can use the "du" command with the "-sh" options.

Here's the command:


du -sh folder-name/
  • "du" stands for "disk usage."
  • "-s" option shows only a total for each argument (the folder in this case)
  • "-h" option makes the output human-readable, using units such as "K" for kilobytes, "M" for megabytes, "G" for gigabytes, etc.
  • "folder-name/" specifies the directory you want to check.

This command will output a single line with the total disk usage of the specified folder and its subdirectories, in human-readable format.

Comments

Leave a Reply