How to check the size of files in a directory in Ubuntu…

In Ubuntu, you can use the du command to view the size of files in a directory.

Open the terminal, navigate to the target directory, and then run the following command:

du -sh *

This will display the size of the files and subdirectories in the directory. The -s option indicates to only show the total size, while the -h option indicates to display the size in a human-readable format.

You can run the following command if you only want to view files (excluding subdirectories):

du -sh -- *

This will ignore the sizes of subdirectories.

If you want to view the size of all files and subdirectories (including hidden files and hidden directories), you can use the following command:

du -sh .[!.]* *

This will include hidden files and hidden directories as well.

bannerAds