In many cases, we want to know how much space the individual files and directories on the hard disk are using. And the total space occupied by a directory. The du command can help us. After we enter the terminal, we can use this command in any directory. Now use this command in the OPT directory of our own Linux system. We tried to enter the command: Du.
In the figure above, we use the Red line to show the size of each file and directory that occupies the hard drive. The position of the green coil is relative to the name of each file and directory. The location of the blue circle is to command the current directory to occupy the hard disk total space. The size is "987568", followed by a "." What does that mean? “.” Represents the current directory.
But is it not easy to see the numbers circled with red lines? Which unit do they use? KB? MB? GB? The numbers we see in the figure above are expressed in "KB". Friends are not 211.html "> It is not intuitive?" It's okay, we can use the-H argument to make the numbers that are returned easier to read. Please enter the command in the terminal: Du-h.
Oh! That makes sense. The current directory uses a total of "965 M" hard disk space. In fact, we can also use the "du" command more easily. For example, now our terminal is located in the "opt" directory. We want to know about other directories that use hard disk space, but don't want to switch to another directory using the CD command. We can use this "du" command format: Du < directory path > < parameter >. Now, can we try to enter a command in the terminal: Du/root-h.
Originally my/root directory uses "965 M" hard disk space.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.