The Linux command du stands for disk usage which is used to check the amount of disk storage any particular directory or file is using. By default, the simple command:
Would return the disk usage in God-knows-what-unit of each of the directories in the current working directory and those beneath them — in a recursive manner. If you happen to have lots of them, the returned stats would be scrolling down crazily which barely makes it any useful.
Even if you have specified a specific directory such as "somedir":
It still works in this uncomfortable way.
The solution is to use the
-sh switch, the one switch a beginner will ever need:
Which simply returns the amount of disk space the current directory and all those stuff in it are using as a whole, something like:
Much much more intuitive and readable.
du -sh somedir
You can find out how much disk storage directory "somedir" is using:
To get all the subsequent / child directories disk usage from the current directory, simply use the asterisk:
du -sh *
It will then list the disk usage of all of them (but not recursively) one by one in a very readable manner:
8.0K dir1 1.4G dir2 135M dir3