du命令

du命令

NAME
du - estimate file space usage
估计文件空间使用情况

SYNOPSIS
du [OPTION]… [FILE]…
du [OPTION]… --files0-from=F

DESCRIPTION
Summarize disk usage of the set of FILEs, recursively for directories.
递归地总结一组文件的磁盘使用情况。(du命令的对象是目录)

   Mandatory arguments to long options are mandatory for short options too.
   长期权的强制参数对于短期权也是强制参数。

查看指定目录大小

在这里插入图片描述

查看指定文件大小

在这里插入图片描述

递归查询文件大小

   -0, --null
          end each output line with NUL, not newline
          用NUL结束每个输出行,而不是换行

   -a, --all
          write counts for all files, not just directories
          递归式写计数的所有文件,不只是目录

在这里插入图片描述
可见如果只是du则递归查询当前所有目录的大小
如果指定-a,则也也递归查询所有文件大小

   --apparent-size
          print apparent sizes, rather than disk usage; although the apparent size is usually smaller, it may be larger due to holes in ('sparse') files, internal fragmentation, indirect blocks, and the like

   -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

按指定内存单位查看

   -b, --bytes
          equivalent to '--apparent-size --block-size=1'
          内存单位为字节

在这里插入图片描述
-k like --block-size=1K
在这里插入图片描述

   -m     like --block-size=1M

打印出total总大小

   -c, --total
          produce a grand total
          合计 打印多了一个total

在这里插入图片描述

   -D, --dereference-args
          dereference only symlinks that are listed on the command line

指定递归层级

   -d, --max-depth=N
          print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument;  --max-depth=0 is the same as --summarize
          仅当目录(或文件)在命令行参数以下N个或更少的级别时,才打印目录(或文件)的total;——max-depth=0等于——summary

只打印第一级目录
在这里插入图片描述

   --files0-from=F
          summarize disk usage of the NUL-terminated file names specified in file F; if F is -, then read names from standard input

   -H     equivalent to --dereference-args (-D)

人性化输出结果(带单位)

   -h, --human-readable
          print sizes in human readable format (e.g., 1K 234M 2G)
          以人类可读格式列印尺寸(例如1K 234M 2G)

在这里插入图片描述
–inodes
list inode usage information instead of block usage

   -L, --dereference
          dereference all symbolic links

   -l, --count-links
          count sizes many times if hard linked



   -P, --no-dereference
          don't follow any symbolic links (this is the default)

   -S, --separate-dirs
          for directories do not include size of subdirectories

   --si   like -h, but use powers of 1000 not 1024

只显示文件总大小(-s 常用)

   -s, --summarize
          display only a total for each argument
          只显示每个参数的总数

在这里插入图片描述
显示当前目录下各个文件大小(包括目录和文件夹)
在这里插入图片描述
-t, --threshold=SIZE
exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative

   --time show time of the last modification of any file in the directory, or any of its subdirectories

   --time=WORD
          show time as WORD instead of modification time: atime, access, use, ctime or status

   --time-style=STYLE
          show times using STYLE, which can be: full-iso, long-iso, iso, or +FORMAT; FORMAT is interpreted like in 'date'

   -X, --exclude-from=FILE
          exclude files that match any pattern in FILE

   --exclude=PATTERN
          exclude files that match PATTERN

   -x, --one-file-system
          skip directories on different file systems

   --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 DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.  Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

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

PATTERNS
PATTERN is a shell pattern (not a regular expression). The pattern ? matches any one character, whereas * matches any string (composed of zero, one or multiple characters). For example, *.o will match any files whose names
end in .o. Therefore, the command

          du --exclude='*.o'

   will skip all files and subdirectories ending in .o (including the file .o itself).

df命令

   df - report file system disk space usage
   报告文件系统磁盘空间使用情况

SYNOPSIS
df [OPTION]… [FILE]…

DESCRIPTION
This manual page documents the GNU version of df. df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted
file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.
此手册页记录了df的GNU版本。df显示包含每个文件名参数的文件系统上可用的磁盘空间量。如果没有指定文件名,则当前挂载的所有文件上的可用空间
显示了文件系统。磁盘空间默认显示为1K块,除非设置了环境变量POSIXLY_CORRECT,在这种情况下使用512字节的块。

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

   If an argument is the absolute file name of a disk device node containing a mounted file system, df shows the space available on that file system rather than on the file system containing the device node.  This version of  df
   cannot show the space available on unmounted file systems, because on most kinds of systems doing so requires very nonportable intimate knowledge of file system structures.

OPTIONS
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.

查看全部文件系统,单位默认KB

在这里插入图片描述
在这里插入图片描述

   -a, --all
          include pseudo, duplicate, inaccessible 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

查看指定文件系统

在这里插入图片描述

人性化打印(-h)

   -h, --human-readable
          print sizes in powers of 1024 (e.g., 1023M)
          列印尺寸以1024倍(例如1023M)为单位

在这里插入图片描述
-H, --si
print sizes in powers of 1000 (e.g., 1.1G)
列印尺寸(例如1.1G)

   -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

   --total
          elide all entries insignificant to available space, and produce a grand total

   -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).

   The SIZE argument is an integer and optional unit (example: 10K is 10*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).

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值