Linux Dir Size: View with ‘du’ Command
You can use the “du” command to check the size of each directory. This command will recursively traverse the specified directories and display the size of each directory.
Here is an example of using the command “du” to view the size of each directory:
- View the size of all subdirectories in the current directory.
du -sh */
- Check the size of all subdirectories in a specified directory.
du -sh /path/to/directory/*/
- Check the sizes of all subdirectories and files in the current directory.
du -sh *
- View the size of all subdirectories and files in a specified directory.
du -sh /path/to/directory/*
In the above command, the option -s represents displaying only the total size without showing the specific size of each subdirectory. The option -h represents showing the size in a human-readable format (e.g. displayed as KB, MB, GB, etc.).
If you want to view more detailed information, you can remove the ‘-s’ parameter and only use the ‘-h’ parameter.
I hope this is helpful for you!