How to Use Linux du -sh Command

The purpose of the “linux du -sh” command is to display the disk usage of a specified directory or file in a human-readable format.

Specifically, this command will calculate the size of all files and subdirectories in the specified directory and display it in easily understandable units (such as KB, MB, or GB). The “-s” parameter indicates that only the total disk usage will be displayed, without listing detailed information for each subdirectory. The “-h” parameter indicates that the output will be displayed in a human-readable format, meaning that disk usage will be shown in larger units (such as GB) rather than in bytes.

For example, running the command “du -sh /home/user” will calculate the size of all files and subdirectories in the “/home/user” directory, and display the total disk usage in a readable format.

bannerAds