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. IIS:错误: 无法提交配置更改,因为文件已在磁盘上更改

    文件名: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config 错误: 无法提交配置更改,因为文件已在磁盘上更改 通过 Micro ...

  2. webapp 微信开发适配问题

    文章摘自:http://www.cnblogs.com/oksite/p/4630462.html 前段时间由于公司要做微信app 前端主要有我一个人独立开发 分享一下自己独立开发微信app的一些经验 ...

  3. mvc Controller类介绍

    1.Controller类 i.Controller必须为公开类: ii.必须以Controller结尾: iii.继承Controller基类或实现IController接口的类: iv.类中必须包 ...

  4. APUE读书笔记:进程控制

    重点函数:fork,exit,_exit 一.fork 函数原型: #include <unistd.> pid_t fork(void) 函数说明:fork函数将创建一个子进程,该函数调 ...

  5. .net项目svn项目管理文件清单

    You can add the following files to Visual Studio source control: Solution files (*.sln). Project fil ...

  6. .htaccess文件url重写小记

    .htaccess文件url重写 当上一条规则匹配 并转换后 符合下一条规则的 继续下一条的匹配转换 RewriteRule ^shangpin-([0-9a-zA-Z]+)/category-([0 ...

  7. Q_DISABLE_COPY

    QObject 中没有提供一个拷贝构造函数和赋值操作符给外界使用,其实拷贝构造和赋值的操作都是已经声明了的,但是它们被使用了Q_DISABLE_COPY() 宏放在了private区域.因此所有继承自 ...

  8. ComboBox绑定Dictionary做为数据源

    http://www.cnblogs.com/refresh/archive/2012/07/14/2591503.html https://msdn.microsoft.com/zh-cn/libr ...

  9. UITextfield的一些属性

    //设置左视图 不用设置frame UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&quo ...

  10. 从市场运营角度谈Uber中国的第一批用户是怎么来的

    声明:这篇文章是从http://www.010lm.com/redian/2016/0312/1206875.html转来的,分享给大家. 1)首先告诉用户Uber是做什么的?即培养用户品牌意识. 我 ...