Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux command explain du -h --max-depth=1 [closed]

Tags:

linux

Can someone explain to me the following command in linux? (I know that with that command you can find the total space taken by each of the directories)

du -h --max-depth=1

Can you suggest a good way to understand in depth these commands?

thanks.

like image 875
KostasA Avatar asked Oct 12 '25 03:10

KostasA


2 Answers

I assume that you want to know about this command in brief so, I'll just break it up for you:

  • du: this command is used to estimate file space usage
  • -h: this parameter is short for --human-readable to print sizes in human readable format
  • --max-depth=1: this parameter defines how deep in terms of folder structure level you want to see the output like is its level 1 then, output will show the size for all the files and folders in current directory but not for the content inside the folders the current directory has

You can use this website to learn more about linux commands: https://explainshell.com/explain?cmd=du+-h+--max-depth%3D1

like image 78
Satyam Bhatia Avatar answered Oct 14 '25 20:10

Satyam Bhatia


I recommend you to use du --help or man du to get help, and try these command yourself. You can remove or change any arguments and find out the differences between them.

-h means human readable, it will display the size like 1K or 3.5G, rather than only a number.

--max-depth=1 means it will only count the files and directories in current directory, sub-directories and sub-files will not display.

like image 22
BadCodeBuilder Avatar answered Oct 14 '25 19:10

BadCodeBuilder