du命令参数详解见: http://baike.baidu.com/view/43913.htm

下面我们只对其做简单介绍;

查看linux文件目录的大小和文件夹包含的文件数

 

统计总数大小

 

du -sh filename(其实我们经常用du -sh *,显示当前目录下所有的文件及其大小,如果要排序再在后面加上 | sort -n)

du -sm * | sort -n //统计当前目录大小 并按大小 排序

du -sk * | sort -n

du -sk * | grep filename //查看一个文件夹的大小

du -m | cut -d "/" -f 2 //看第二个/ 字符前的文字

查看此文件夹有多少文件 /*/*/* 有多少文件

du filename/

du filename/*/*/* |wc -l

40752

解释:

wc [-lmw]

参数说明:

-l :多少行

-m:多少字符

-w:多少字

或者也可以打开Nautilus窗口(文件夹首选项),点击“编辑”-“首选项”,切换到“显示”标签,改变“图标标题”下面的树形列表的内容为“大小,修改日期、类型”。设置立即生效。现在在文件图标的下面会显示文件的大小。

PS:

df -hl 查看磁盘剩余空间

du -sm 文件
返回该文件夹总M数

更多功能查看:
df --help
du --help

du --help
用法:du [选项]... [文件]...
总结每个<文件>的磁盘用量,目录则取总用量。
长选项必须用的参数在使用短选项时也是必须的。
-a, --all             write counts for all files, not just directories
      --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 use SIZE-byte blocks
-b, --bytes           equivalent to `--apparent-size --block-size=1'
-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 be equivalent to --dereference-args (-D)
-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
      --si              like -h, but use powers of 1000 not 1024
-k                    like --block-size=1K
-l, --count-links     count sizes many times if hard linked
-L, --dereference     dereference all symbolic links
-P, --no-dereference don'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)
                          only if it is N or fewer levels below the command
                          line argument; --max-depth=0 is the same as
                          --summarize
      --help     显示此帮助信息并离开
      --version 显示版本信息并离开

Linux查看文件夹大小du的更多相关文章

  1. linux 查看文件夹大小 du -h --max-depth=1 ./

    du:查询文件或文件夹的磁盘使用空间 如果当前目录下文件和文件夹很多,使用不带参数du的命令,可以循环列出所有文件和文件夹所使用的空间.这对查看究竟是那个地方过大是不利的,所以得指定深入目录的层数,参 ...

  2. linux查看文件夹大小du命令

    查看1级(--max-depth=1)目录的大小,并排序 参考 -h或–human-readable 以K,M,G为单位,提高信息的可读性. –max-depth= 超过指定层数的目录后,予以忽略 d ...

  3. linux查看文件夹大小,备份文件夹zip压缩解压

    linux查看文件夹大小,备份文件夹zip压缩解压 du -sh : 查看当前目录总共占的容量.而不单独列出各子项占用的容量 du -lh --max-depth=1 : 查看当前目录下一级子文件和子 ...

  4. linux查看文件夹大小

    du -sh 查看当前文件夹大小 du -sh * | sort -n 统计当前文件夹(目录)/文件的大小,并按文件大小排序 ------------------------------------- ...

  5. 目录和文件 按创建时间排序du -h --time --max-depth=1 . |sort -r -t $'\t' -k 2 Linux查看文件夹大小,并按文件夹创建时间排序

    目录和文件 按创建时间排序 # du -h --time --max-depth=1 . |sort -r -t $'\t' -k 230M 2020-04-01 14:54 .28K 2020-04 ...

  6. Linux 查看文件夹大小(排序)

    du -s * | sort -nr (-n是按数字大小排序,不能加上参数h)

  7. linux 查看文件夹大小

    参考链接:  http://www.cnblogs.com/iconfig/p/4863063.html

  8. linux 查看文件夹下的文件个数(当前目录的文件数)//包含子目录

    ls -l |grep "^-"|wc -l   //验证了redhat好用 或 find ./company -type f | wc -l 查看某文件夹下文件的个数,包括子文件 ...

  9. du 使用详解 linux查看目录大小 linux统计目录大小并排序 查看目录下所有一级子目录文件夹大小 du -h --max-depth=1 |grep [

    常用命令 du -h --max-depth=1 |grep [TG] |sort   #查找上G和T的目录并排序 du -sh    #统计当前目录的大小,以直观方式展现 du -h --max-d ...

随机推荐

  1. hadoop 及hbase zookeeper 经常出现问题

    往往是以下几个 1/ 各节点时间不统一(写shell文件统一时间) 2/配置文件 /etc/hosts文件中ip地址配置错误(更新ip) 3/断网后重启机器 ip地址被修改(更新配置文件中的ip)

  2. jquery各版本区别

     jquery版本区别:          1.3一般功能够 1.4.2一般功能够而且稳定 1.7+比较新特性 2不支持老IE 兼容的话最好选 1.x.稳定性就用1.7或者1.4,其中1.4的体积相对 ...

  3. Java中精确的数字计算类BigDecimal

    在日常开放当中需要我们计算数字,利率.通常Java的做法是使用Math相关的API.但是,这样做是不够精确的,由于float和double不能进行计算,如果强行进行计算会使得计算不准确.造成难以挽回的 ...

  4. VBS一键配置VOIP脚本(其中包括VBS操作JS网页中的按钮事件--直接执行确认按钮中的脚本代码)

    Dim ws,fso,IESet IE = WScript.createobject("InternetExplorer.Application")Set ws = WScript ...

  5. vbs鼠标方法——模拟鼠标按键

    '*********************************************************************** ' 代码开始 '******************* ...

  6. js 输出HTML 样式

    document.write("<div style='width: 100px;height: 100px;background-color: greenyellow;'>Th ...

  7. /etc/fstab 文件解释

    /etc/fstab 文件解释 文件fstab包含了你的电脑上的存储设备及其文件系统的信息.它是决定一个硬盘(分区)被怎样使用或者说整合到整个系统中的唯一文件. 这个文件的全路径是/etc/fstab ...

  8. hdu_5793_A Boring Question(打表找规律)

    题目链接:hdu_5793_A Boring Question 题意: 自己看吧,说不清楚了. 题解: 打表找规律 #include<cstdio> typedef long long l ...

  9. LeetCode OJ 99. Recover Binary Search Tree

    Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing ...

  10. 认识cookie与session的区别与应用

    通常我们所说的浏览器自动保存密码,下次不用登陆,网页换皮肤,用户引导,提示一次就不再出现的内容,大部分通过cookie或者session来实现的,在这次制作用户引导中,本人就用到了cookie的内容, ...