Linux中df命令查看磁盘使用情况

几乎只要建站用的VPS都以Linux居多,免费又好用。

虽不能把全部Liunx命令记住,但必要的命令还是要记下为好,今天介绍的命令是df磁盘空间占用情况查看命令

看看帮助文档:

[nicholas@qttc ~]$ 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  use SIZE-byte blocks
      --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)
  -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 may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

Report df bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'df invocation'

df命令可以检查文件系统的磁盘空间占用情况。可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息

df [option]

Linux中df命令可显示所有文件系统对i节点和磁盘块的使用情况, 该命令各个选项的含义如下

-a 显示所有文件系统的磁盘使用情况,包括0块(block)的文件系统,如/proc文件系统 -k 以k字节为单位显示 -i 显示i节点信息,而不是磁盘块 -t 显示各指定类型的文件系统的磁盘空间使用情况 -x 列出不是某一指定类型文件系统的磁盘空间使用情况(与t选项相反) -T 显示文件系统类型

使用df -i

[nicholas@qttc ~]$ df -i
Filesystem       Inodes IUsed    IFree IUse% Mounted on
/dev/xvda1     20480000 78530 20401470    1% /
tmpfs            127289     1   127288    1% /dev/shm

使用df -hl

[nicholas@qttc ~]$ df -hl
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G   12G  8.5G  57% /
tmpfs           498M     0  498M   0% /dev/shm
分享

TITLE: Linux中df命令查看磁盘使用情况

LINK: https://www.qttc.net/64-linux-df.html

NOTE: 原创内容,转载请注明出自琼台博客