How to check the file size of a subdirectory on Linux



Display the file size of the subdirectory

We need to display the space occupied by the subdirectories of the next level of the current directory. We can use the du command. In order to view the file size more intuitively, we also need to add the "-h" parameter. After adding the "-h" parameter, the optimal unit will be used to display the file size value. We also need to control to display only one level of subdirectories, so another parameter "--max-depth=1" must be used. The complete command can refer to the following.

            du -h --max-depth=1