du -- disk usage

du的英文为:disk usage,含义是磁盘空间使用情况,功能是逐级进入指定目录的每一个子目录并显示该目录占用文件系统数据块的情况,如果没有指定目录,则对当前的目录进行统计。

面对对象时目录文件,而不是其他普通文件

NAME
       du - estimate file space usage

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

DESCRIPTION
       Summarize disk usa-- 只显示大小大于SIZE的目录文件

ge of each FILE, recursively for directories.

Mandatory arguments to long options are mandatory for short options too.

(一)显示单位选项:

-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
       -h, --human-readable
              print sizes in human readable format (e.g., 1K 234M 2G) (来个自动选择显示单位,类似与free命令)
       --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

-c, --total             produce a grand total  -- 最后显示总的空间大小
(此处牵扯到一个概念:实际文件大小与disk usage的差别)

(二)范围圈定选项(选出符合特定条件的文件):

I.深度:

-d, --max-depth=N      -- 指定统计的文件的深度 (有点类似与find的一个参数)
              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

II.大小

-t, --threshold=SIZE    
              exclude  entries  smaller  than  SIZE  if  positive, or entries
              greater than SIZE if negative

1 +SIZE (K | M | G ...) 只显示大小大于SIZE的目录文件
2 -SIZE   (K | M | G ... ) 只显示大小小于SIZE的目录文件

III.时间

--time show time of the last modification of any file  in  the  direc‐
              tory, 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 STYLE: full-iso, long-iso, iso,  +FORMAT
              FORMAT is interpreted like ‘date‘
显示时间一览中,指定显示的特定时间是   atime access use ctime or status

严格来说这个选项不是起到范围排除的作用只是一个附加项

IV.exclude

-X, --exclude-from=FILE    这个没看懂
              exclude files that match any pattern in FILE

   --exclude=PATTERN           任何符合PATTERN的目录均不在显示之列(可以使用通配符来扩展)
              exclude files that match PATTERN

-x, --one-file-system
              skip directories on different file systems
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).
对于PATTERN可以使用通配符进行匹配(不是正则表达式)这是个很有用的选项。

时间: 2024-08-29 03:27:53

du -- disk usage的相关文章

Windows 8 Disk Usage Keep up 100%

Recently i find the windows8 Disk Usage always keep up 100%, It must be have some issue. Step1. Go into Open Task Manager Step2. Go to Details tab Step3. Right click the columns headers and click "Select Columns" Step4. From the "Select Col

WinDirStat is a disk usage statistics viewer

WinDirStat is a disk usage statistics viewer and cleanup tool for various versions of Microsoft Windows.Note: if you are looking for an alternative for Linux, you are looking for KDirStat (apt-get install kdirstat on Debian-derivatives) and for MacOS

--------------Linux命令du

===========shuxiangguo============ 学习于http://roclinux.cn/?p=49 du:disk usage硬盘使用 1.du -h . “.”代表当前目录下.也可以换成一个明确的路径 -h表示用K.M.G的方便人们阅读的形式显示 2.du -d 1 . -d表示迭代深度,当前目录深度是0 1表示最深迭代到当前目录的下一个深度,等价的命令是du --max-depth 1 .可以通过man du查看更加详细的信息. 3. du -ah abc 列出ab

每天一个linux命令:du

1.命令简介 du (Disk usage) 用来计算每个文件的磁盘用量,目录则取总用量. 2.用法 用法:du [选项]... [文件]... 或:du [选项]... --files0-from=F 3.选项 4.示例 示例1:显示单个文件的大小(默认为k) [[email protected] alertscripts]# du sendim.py 4 sendim.py 示例2:以人性化的方式显示文件大小 [[email protected] alertscripts]# du -h s

【转】Linux命令之查看文件占用空间大小-du,df

原文网址:http://blog.csdn.net/wangjunjun2008/article/details/19840671 du(disk usage),顾名思义,查看目录/文件占用空间大小 #查看当前目录下的所有目录以及子目录的大小$ du -h $ du -ah #-h:用K.M.G的人性化形式显示 #-a:显示目录和文件   du -h tmp du -ah tmp#只查看当前目录下的tmp目录(包含子目录)的大小 #查看当前目录及其指定深度目录的大小du -h –-max-dep

du与df区别以及出现较大差距时解决方法

在linux下查看磁盘使用率,最常用到的是df和du,但是有时就会发现du 和df出来的结果并不完全相同,有时候还有很大差距 1. 两个命令的解释 du  --disk usage df  -- disk free 2.du 和df 工作原理 2.1 du工作原理 du命令会对待统计的文件逐个调用fstat这个系统调用,来获取文件大小.它的数据是基于文件获取的,有很大的灵活性.不一定非 要针对一个分区,可以跨多个分区操作,如果针对的目录中文件的个数较多,du的速度就会很慢了. 2.2 df 工作

浅谈Linux的du命令

**du(disk usage),顾名思义,查看目录/文件占用空间大小** 1.查看当前目录下的所有目录以及子目录的大小  du -h du -ah #-h:用K.M.G的人性化形式显示#-a:显示目录和文件 du -h tmp du -ah tmp #只查看当前目录下的tmp目录(包含子目录)的大小 2.查看当前目录及其指定深度目录的大小 du -h –-max-depth=0 #-–max-depth=n:只深入到第n层目录,此处设置为0,即表示不深入到子目录 3.du命令的一些常用参数:

du和df不一致的解决方法

df:disk free,统计的是当前系统中空闲的磁盘du:disk usage,统计的是正在使用的空闲的磁盘.如果一个文件被删除之后,使用这个文件的进程未重启,则会出现df和du不一致的情况. 解决方法:1. 运行命令 lsof | grep deleted列出所有已被删除但还被进程占用的文件2. Kill 掉占用删除文件的进程. 参考1. http://www.cnblogs.com/heyonggang/p/3644736.html

【Linux命令与工具】磁盘与目录的容量——df和du

df(disk free):列出文件系统的整体磁盘使用量 用法: df [-akmhi] [目录或文件名] 参数: -a: 列出所有的文件系统,包括系统特有的/proc等文件系统 -k: 以KB的容量显示各文件系统: -m: 以MB的容量显示各文件系统: -h: 以人们较易阅读的GB.MB.KB等格式自行显示: -i: 不用硬盘容量,而以inode的数量来显示. 常用用法: 1. df -h //将系统内所有的文件系统列出来,并将结果以较易阅读的格式显示 输出信息详解: 1. Filesyste