Linux查看文件夹大小du
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:
du -sm 文件夹
返回该文件夹总M数
更多功能查看:
df --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的更多相关文章
- linux 查看文件夹大小 du -h --max-depth=1 ./
du:查询文件或文件夹的磁盘使用空间 如果当前目录下文件和文件夹很多,使用不带参数du的命令,可以循环列出所有文件和文件夹所使用的空间.这对查看究竟是那个地方过大是不利的,所以得指定深入目录的层数,参 ...
- linux查看文件夹大小du命令
查看1级(--max-depth=1)目录的大小,并排序 参考 -h或–human-readable 以K,M,G为单位,提高信息的可读性. –max-depth= 超过指定层数的目录后,予以忽略 d ...
- linux查看文件夹大小,备份文件夹zip压缩解压
linux查看文件夹大小,备份文件夹zip压缩解压 du -sh : 查看当前目录总共占的容量.而不单独列出各子项占用的容量 du -lh --max-depth=1 : 查看当前目录下一级子文件和子 ...
- linux查看文件夹大小
du -sh 查看当前文件夹大小 du -sh * | sort -n 统计当前文件夹(目录)/文件的大小,并按文件大小排序 ------------------------------------- ...
- 目录和文件 按创建时间排序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 ...
- Linux 查看文件夹大小(排序)
du -s * | sort -nr (-n是按数字大小排序,不能加上参数h)
- linux 查看文件夹大小
参考链接: http://www.cnblogs.com/iconfig/p/4863063.html
- linux 查看文件夹下的文件个数(当前目录的文件数)//包含子目录
ls -l |grep "^-"|wc -l //验证了redhat好用 或 find ./company -type f | wc -l 查看某文件夹下文件的个数,包括子文件 ...
- 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 ...
随机推荐
- C++ : 从栈和堆来理解C#中的值类型和引用类型
C++中并没有值类型和引用类型之说,标准变量或者自定义对象的存取默认是没有区别的.但如果深入地来看,就要了解C++中,管理数据的两大内存区域:栈和堆. 栈(stack)是类似于一个先进后出的抽屉.它的 ...
- RVM: instsallation
login as user, do the following: curl -L https://get.rvm.io | sudo bash -s stable # add user to grou ...
- Apache+Tomcat服务器集群配置
在实际应用中,如果网站的访问量很大,为了提高访问速度,可以与多个Tomcat服务器与Apache服务器集成,让他们共同运行servlet/jsp 组件的任务,多个Tomcat服务器构成了一个集群(Cl ...
- [原]innerText与innerHTML区别
window.onload = function () { document.getElementById('btn1').onclick = function () { ...
- 关于个人网站选择虚拟主机还是VPS服务器的讨论
还记得当初才开始学习建站的时候,选择的第一款虚拟主机是全HTML的主机,那时候的虚拟主机还分为HTML或者是ASP,PHP的都很少,在国内接触的学习较多还是以ASP为主,PHP是最近几年才开始流行.如 ...
- OpenCV使用边缘提取、腐蚀、轮廓进行车牌定位
http://blog.csdn.net/superdont/article/details/24935383 OpenCV使用边缘提取.腐蚀.轮廓进行车牌定位 2014-05-03 21:38 67 ...
- LeetCode OJ 235. Lowest Common Ancestor of a Binary Search Tree
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...
- Django:之BBS项目
首先新建一个BBSProject项目,在建一个app,把app导入到项目中. 在项目BBSProject中的settings.py中, INSTALLED_APPS = [ 'django.contr ...
- 算法:1!+(1!+3!)+(1!+3!+5!) + ( 1! + 3! + 5! + 7! + 9!)+....+(1!+3!+5!+ ... + m!)
-(void)touchesBegan:(nonnull NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{ / ...
- mongodb分片
在系统早期,数据量还小的时候不会引起太大的问题,但是随着数据量持续增多,后续迟早会出现一台机器硬件瓶颈问题的.而mongodb主打的就是海量数据架构,他不能解决海量数据怎么行!不行!“分片”就用这个来 ...