Article Title: shows you how to use a Linux File System. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Commands such as df, du, and ls
Df collects statistics on the usage of the file system.
English description:
This manual page documents the GNU version of df. df displays theamount of disk space available on the filesystem containing each filename argument. if no file name is given, the space available on alcurrently mounted filesystems is shown. disk space is shown in 1 K blocksby default, unless the environment variable POSIXLY_CORRECT
Is set, in which case 512-byte blocks are used.
If an argument is the absolute file name of a disk device node containga mounted filesystem, df shows the space available on that filesystemrather than on the filesystem containing the device node (which is alwaysthe root filesystem ). This version of df cannot show the space availableon unmounted filesystems, because on most kinds of systems doing so requiresvery nonportable intimate knowledge of filesystem structures.
Key points are as follows:
If no parameter is added, the file system currently loaded is displayed. The default unit is 1K-blocks. If POSIXLY_CORRECT is set, the unit is 512-byte blocks. This command targets the file system, not the directory, although the parameter can be a directory.
Main parameters:
The file system currently loaded does not contain 0 blocks.
-A contains 0 blocks of space
-H Easy-to-Read mode
-KB
-L local
-T display file system type
-- Call the sync command before sync returns the result (what is the use ?)
Instance:
[Root @ Mother_FLASH ~] # Df
Filesystem 1K-blocks Used Available Use % Mounted on
/Dev/md0 28826556 1507948 25854292 6%/usr
/Dev/md1 19220436 9153312 9090780 51%/var
/Dev/ram1 158667 85032 73635 54%/
/Dev/shm 1037388 0 1037388 0%/dev/shm
[Root @ Mother_FLASH ~] # Df-ah
Filesystem Size Used Avail Use % Mounted on
/Dev/md0 28G 1.5G 25G 6%/usr
/Dev/md1 19G 8.8G 8.7G 51%/var
/Dev/ram1 155 M 84 M 72 M 54%/
/Dev/proc 0 0 0-/proc
/Dev/sys 0 0 0-/sys
/Dev/devpts 0 0 0-/dev/pts
/Dev/shm 1014 M 0 1014 M 0%/dev/shm
None 0 0 0-/proc/sys/fs/binfmt_misc
For details, refer:
-A, -- all
Include filesystems having 0 blocks
-B, -- block-size = SIZE use SIZE-byte blocks
-H, -- human-readable
Print sizes in human readable format (e.g., 1 K 234 M 2G)
-H, -- si
Likewise, but use powers of 1000 not 1024
-I, -- inodes
List inode information instead of block usage
-K like -- block-size = 1 K
-L, -- local
Limit listing to local filesystems
-- No-sync
Do not invoke sync before getting usage info (default)
-P, -- portability
Use the POSIX output format
-- Sync invoke sync before getting usage info
-T, -- type = TYPE
Limit listing to filesystems of type TYPE
-T, -- print-type
Print filesystem type
-X, -- exclude-type = TYPE
Limit listing to filesystems not of type TYPE type
-V (ignored)
-- Help display this help and exit
-- Version
Output version information and exit
SIZE may be (or may be an integer optionally followed by) one
Following: kB 1000, K 1024, MB 1000*1000, M
1024*1024, and so on for G, T, P, E, Z, Y.
Df calculates the usage of each directory.
Main parameters:
The file system currently loaded does not contain 0 blocks.
-A collects statistics on all directories and files, including hidden
-S generates only one statistical information.
-KB
-H Easy-to-Read mode
-L do not calculate the symbolic connection
-M is in MB.
For more information, see
-A, -- all
Write counts for all files, not just directories
-- Apparent-size
Print apparent sizes, rather than disk usage; although the apparentsize is usually smaller, it may be
Larger due to holes in (?? Sparsea ??) Files, internal fragmentation, indirect blocks, and the like
-B, -- block-size = SIZE use SIZE-byte blocks
-B, -- bytes
Equivalent to ?? -- Apparent-size -- block-size = 1a ??
-C, -- total
Produce a grand total
-D, -- dereference-args
Dereference FILEs that are symbolic links
-H like -- si, but also evokes a warning; will soon change to beequivalent to -- dereference-args (-D)
-H, -- human-readable
Print sizes in human readable format (e.g., 1 K 234 M 2G)
-- Si like-h, but use powers of 1000 not 1024
-K like -- block-size = 1 K
-L, -- count-links
Count sizes when times if hard linked
-L, -- dereference
Dereference all symbolic links
-P, -- no-dereference
Dona ?? T follow any symbolic links (this is the default)
-0, -- null
End each output line with 0 byte rather than newline
-S, -- separate-dirs
Do not include size of subdirectories
-S, -- summarize
Display only a total for each argument
-X, -- one-file-system
Skip directories on different filesystems
-X file, -- exclude-from = FILE
Exclude files that match any pattern in FILE.
-- Exclude = PATTERN Exclude files that match PATTERN.
-- Max-depth = N
Print the total for a directory (or file, with -- all) onlyif it is N or fewer levels below the command line
Argument; -- max-depth = 0 is the same as -- summarize
-- Help display this help and exit
-- Version
Output version information and exit
Ls? Lh shows the size of the current directory file (excluding the Directory), such as the following 322 M.
[Root @ LS-SVR-18 ~] # Ls-lh
Total 322 M
-Rw-r -- 1 root 312 M Aug 1 23:35 10.50.86.18.tar.z
-Rw-r -- 1 root 1.3 K Aug 1 anaconda-ks.cfg
Drwxr-xr-x 2 root 4.0 K Aug 1 Desktop
-Rw-r -- 1 root 62 K Aug 1 17: 41 install. log
-Rw-r -- 1 root 5.2 K Aug 1 :41 install. log. syslog
-Rw-r -- 1 root 8.9 M Sep 28 15: 29 Install_MSN_Messenger_zhcn.EXE
-Rwxr-xr-x 1 root 9.2 K Aug 16 11: 20 m64
-Rw-r -- 1 root 1.1 K Aug 16 11: 20 m64.c
-Rw-r -- 1 root 1.1 K Aug 8 04:33 m64.o
Drwxr-xr-x 2 root 4.0 K Oct 9 MCA
Drwxr-xr-x 2 root 4.0 K Oct 9 MGM
Drwxr-xr-x 2 root 4.0 K Oct 9 MYSQL
-Rw -- 1 root 95 Sep 5 10: 34 nohup. out
The same result is returned when du-sSh is used.
[Root @ LS-SVR-18 ~] # Du-sSh
322 M
Using du-sh contains sub-directory content
[Root @ LS-SVR-18 ~] # Du-sh
451 M.
View the size of each file and directory
[Root @ LS-SVR-18 ~] # Du-sh *
313 M 10.50.86.18.tar.z
8.0 K anaconda-ks.cfg
8.0 K Desktop
72 K install. log
12 K install. log. syslog
8.9 M Install_MSN_Messenger_zhcn.EXE
16 K m64
8.0 K m64.c
8.0 K m64.o
476 K MCA
65 M MGM
65 M MYSQL
8.0 K nohup. out