To check how much space is left on the disk, use the df command. [Root @ localhost ~] # Df-h file system capacity in use % available mount point/dev/sda2 14G 11G 2.6G 82%/dev/sda1 99 M 14 M 81 M 14%/boot tmpfs 442 M 275 M 168 M 63%/dev/shm/dev/mapper/vg_test-lv_test 24 M 1.3 M 21 M 6%/mnt/lvm [root @ localhost ~] # Of course, you may not be concerned with the amount of space remaining on the disk. You need to know the disk usage in the current folder: [root @ localhost ~] # Du -- max-depth = 1-h 24 K. /. gnome www.2cto.com 8.0 K. /. eggcups 8.0 K. /. config 136 K. /. gnome2 16 K. /. chewing 8.0 K. /. gnome2_private 8.0 K. /. trash 224 K. /. gstreamer-0.10 28 K. /Desktop 48 K. /. nautilus 48 K. /. metacity 240 K. /. scim 3.4 M. /. mozilla 1012 K. /. kde 12 K. /. superkaramba 40 K. /. local 8.0 K. /. qt 272 K. /. gconf 32 K. /. mcop 16 K. /. redhat 1.7 M. /. thumbnails 8.0 K. /. gconfd 7.5 M. [root @ localhost ~] # Check that the command du -- max-depth = 1-h is used to find the disk usage. Because there is no following path, it is the current path by default. The-h Parameter of this command is used to make it easy for you to understand the size of each file. Without this parameter, the file size is not k, M, G, and so on. After the command is executed, n-1-1 line shows 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 just want to know the size of one of the files (folders). Is there a solution? Of course, you should remember that I have always stressed that there are always more methods than problems, and this is no exception here. See the following example: [root @ localhost ~] # Du-sh 7.5 M. www.2cto.com [root @ localhost ~] # Clever, you must have found that the size shown here is the same as the size of the last line above. This means that the displayed size is the total size of the directory. I know that you are sneering in your heart, isn't there more ways than problems? There is only one answer here. Of course, I won't disappoint you. Another method is relatively good, but it can still solve the problem. [Root @ localhost ~] # Du-h -- max-depth = 0 7.5 M. [root @ localhost ~] # What I want to tell you is that the features of -- max-depth = 0 are the same as those of-s. Of course, you can use sed to print the last line of du-h -- max-depth = 1 to solve the problem, but I do not recommend it. This involves a principle. Try to use the command to provide the original function of the option. If the command does not provide this function, we need to use grep, sed, and awk to select the required line. 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 ~] # If the disk is too large, it will be too busy to check the file size. Please wait for a while. Author tl_oni