Linux df 命令用法详解

2013-9-26 杜世伟 Linux

Linux df 命令用法详解:显示磁盘的相关信息
df命令用于显示磁盘分区上的可使用的磁盘空间。默认显示单位为KB。可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息。

语法
# df --help
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all             include dummy file systems
  -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes;
                           see SIZE format below
      --direct          show statistics for a file instead of mount point
      --total           produce a grand total
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024
  -i, --inodes          list inode information instead of block usage
  -k                    like --block-size=1K
  -l, --local           limit listing to local file systems
      --no-sync         do not invoke sync before getting usage info (default)
      --output[=FIELD_LIST]  use the output format defined by FIELD_LIST,
                               or print all fields if FIELD_LIST is omitted.
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
  -v                    (ignored)
      --help     display this help and exit
      --version  output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).

FIELD_LIST is a comma-separated list of columns to be included.  Valid
field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',
'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info page).

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>;
For complete documentation, run: info coreutils 'df invocation'


df(选项)(参数)
选项
-a或--all:包含全部的文件系统;
--block-size=<区块大小>:以指定的区块大小来显示区块数目;
-h或--human-readable:以可读性较高的方式来显示信息;
-H或--si:与-h参数相同,但在计算时是以1000 Bytes为换算单位而非1024 Bytes;
-i或--inodes:显示inode的信息;
-k或--kilobytes:指定区块大小为1024字节;
-l或--local:仅显示本地端的文件系统;
-m或--megabytes:指定区块大小为1048576字节;
--no-sync:在取得磁盘使用信息前,不要执行sync指令,此为预设值;
-P或--portability:使用POSIX的输出格式;
--sync:在取得磁盘使用信息前,先执行sync指令;
-t<文件系统类型>或--type=<文件系统类型>:仅显示指定文件系统类型的磁盘信息;
-T或--print-type:显示文件系统的类型;
-x<文件系统类型>或--exclude-type=<文件系统类型>:不要显示指定文件系统类型的磁盘信息;
--help:显示帮助;
--version:显示版本信息。
参数
文件:指定文件系统上的文件。


用法
[root@localhost data]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda3       18555904 6062324  12493580  33% /
devtmpfs          490008       0    490008   0% /dev
tmpfs             499848       0    499848   0% /dev/shm
tmpfs             499848    6892    492956   2% /run
tmpfs             499848       0    499848   0% /sys/fs/cgroup
/dev/sda1         303780  104204    199576  35% /boot
tmpfs              99972       0     99972   0% /run/user/0

标签: linux df

Powered by emlog 沪ICP备2023034538号-1