The Linux du command also looks at the usage space, but unlike the DF command, the Linux du command is a view of the space used by files and directory disks, or some difference from the DF command.
1. Command format:
du [Options] [file]
2. Command function:
Displays the disk usage space for each file and directory.
3. Command parameters:
A or-all displays the size of individual files in the directory.
-B or-bytes displays the directory or file size in bytes.
-C or--total displays the sum of all directories or files in addition to the size of individual directories or files.
-K or--kilobytes is output in kilobytes (1024bytes).
-M or--megabytes is output in MB.
-S or--summarize only displays totals, listing only the last plus total value.
-H or--human-readable to k,m,g to improve the readability of the information.
-X or--one-file-xystem the file system at the start of the process, and if you encounter a different file system directory, skip.
-l< Symbolic link > or--dereference< the source file size of the symbolic link specified in the symbol link > Display option.
When-S or--separate-dirs displays the size of an individual directory, it does not contain the size of its subdirectories.
-x< files > or--exclude-from=< files > specify directories or files in < file >.
--exclude=< directory or File > skips the specified directory or file.
-D or--dereference-args displays the source file size for the specified symbolic link.
The-H or--si is the same as the-h parameter, but K,m,g is a unit of conversion in 1000.
-L or--count-links a file that duplicates the hardware link.
4. Use instance:
Example 1: Displays the directory or the space occupied by the file
Command:
Du
Output:
[Root@localhost test]# du
608./test6
308./test4
4./scf/lib
4./scf/service/deploy/product
4./scf/service/deploy/info
/scf/service/deploy
/scf/service
4./scf/doc
4./scf/bin
/scf
8./test3
1288.
[Root@localhost test]#
Description
Displays only the directory size of the subdirectory below the current directory and the total size of the current directory, and the bottom 1288 is the total size of the current directory
Example 2: Displays the space occupied by the specified file
Command:
Du Log2012.log
Output:
[Root@localhost test]# du Log2012.log
Log2012.log
[Root@localhost test]#
Description
Example 3: View the space occupied by the specified directory
Command:
Du SCF
Output:
[Root@localhost test]# du SCF
4 Scf/lib
4 scf/service/deploy/product
4 Scf/service/deploy/info
Scf/service/deploy
Scf/service
4 Scf/doc
4 Scf/bin
Scf
[Root@localhost test]#
Description