How do I check the size of a specific directory in Linux?

To check the size of a specific directory, you can use the following command:

du -sh /path/to/directory

The -s parameter displays only the total size, without showing the size of each subdirectory; the -h parameter displays the file size in a human-readable format (such as GB, MB, etc). Replace /path/to/directory with the directory path you want to view.

bannerAds