How to calculate the size of the current folder on Ubuntu?

You can use the du command to calculate the size of the current folder in Linux. The du command stands for “disk usage” and it gives you information on the amount of disk space that a file or directory is occupying.

To calculate the size of the current folder, simply navigate to the directory in the terminal and run the following command:

``
du -sh

1
2
3
4
5
6
7
8
9
Breaking down the options used in the command:

-s option displays only a total for each argument
-h option prints human-readable sizes, such as 2.5K, 1.2M, etc.
. is used to specify the current directory
This will output the size of the current directory in a human-readable format.

If you want to see the size of every file and subdirectory in the current directory, you can use the following command:

du -h

This command will list the size of every file and subdirectory in the current directory, in a human-readable format.