There are a lot of tools for viewing Linux disk space, so how do you use commands to view disk space? That will use the df command, the following small series for everyone to introduce the use of df command to view the Linux disk space.
[root @ localhost ~] # df -h
with file system capacity has been available with
mount point%
/dev /sda2 14G 11G 2.6 G 82% /
/dev/sda1 99M 14M 81M 14% /boot
tmpfs 442M 275M 168M 63% /dev/shm
/dev/mapper/vg_test- Lv_test
24M 1.3M 21M 6% /mnt/lvm
[root@localhost ~]#
Of course you may not be related to how much space the disk still has, you are Need to know the disk usage under the current folder:
[root@localhost ~]# du --max-depth=1 -h
24K . /.gnome www.2cto.com
8.0K. /.eggcups
8.0K. /.config
136K . /.gnome2
16K. /.chewing
8.0K. /.gnome2_private
8.0K. /.Trash
224K. /.gstreamer-0.10
28K. /Desktop
48K. /.nautilus
48K. /.metacity
240K. /.scim
3.4M. /.mozilla
1012K. /.kde
12K. /.superkaramba
40K. /.local
8.0K. /.qt
272K. /.gconf
32K. /.mcop
16K. /.redhat
1.7M. /.thumbnails
8.0K. /.gconfd
7.5M.
[root@localhost ~]#
See the above command using du --max-depth=1 -h to find the disk usage, because there is no path followed, it The default is the current path. The -h parameter of this command is for you to read the size of each file. If there is no file size displayed by this parameter, there is no k, M, G, etc. After executing the command, the first n-1 lines are the size of each folder in the directory. The last line shows the total size of the directory.
Then you will say that you don't care about the size of each file in the directory. You only want to know the size of one of the files (folders). Is there any way? Of course, you should remember that I have always stressed that there are always more methods than problems, and this is no exception.
Please see the following example:
[root@localhost ~]# du -sh
7.5M . Www.2cto.com
[root@localhost ~]#
You must have found that the size shown here is the same as the size of the last line above. This means that the size shown here is the total size of the directory.
I know that you are sneer in your heart, isn't the method more than the problem? There is only one answer here. Of course, I won't let you down. Another method is more soil, but it can still solve the problem.
[root@localhost ~]# du -h --max-depth=0
7.5M .
[root@localhost ~]#
What I want to tell you is that the man page has already told you that the function of --max-depth=0 is the same as the function of -s.
Of course, you can also use sed to print the last du -h --max-depth=1 line to solve the problem, but I don't recommend it.
This involves a principle, try to use the command to provide the original functionality of the option. If the command does not provide this feature, we need to use grep, sed, awk to select the rows we need.
Of course, the du command can be followed by the file path to view the size of the specified path.
[root@localhost ~]# du -sh /opt/oracle
5.6G /opt/oracle
[root@localhost ~]#
The above is the introduction of the Linux disk space using the df command. If the disk is large, it may take more time. Have you learned it?
Sometimes you want to sniff HTTP traffic for some kind of need, so how do you sniff
LVM is an abbreviation of logical partition management, which is an abstract management layer. Wheth
When there is still a lot of space on the Linux system hard disk, we can use the fd
Linux history command is used to view the used commands, often used in Linux system operations, is a
Ubuntu compile and install Hypertable method
How to set up Kali Linux after installation?
X11 forwarding request failed on channel 0 error under Linux
Linux uses the hadoop dfs command method
How to use Linux to clear Bash environment variables with commands
Linux system how to use the crond command
How to use the CRT command tool to view Linux system resource information
Introduction to the Linux file system
What should I do if ORA-12528 reports an error when building DataGuard in Linux?
How to burn an image file to a DVD disc under Linux
Frequently Asked Questions for ADBlock Ad Blocker Software
Quick Shutdown/Restart Win 8 Practical Tips
Solve the problem that windows7 resource manager has stopped working
Improve XP system speed: Turn off the five network functions
How to upgrade Win10 Build 9926? Windows10 9926 pure 8 minutes installation tutorial
How does Win7 cancel the disabled add-on?
Win8/office phone activates English voice Chinese translation
How to effectively remove the pop-up ads in the lower right corner of Win7 system
Microsoft offline store: unable to upgrade Win10 free to buy Dell Inspiron 15
Live account login win8 system does not need to lose the password method