击:我怎么能列出每个文件和目录(递归)的大小,按大小排序decendingly? [英] Bash: How can I list out the size of each file and directory (recursively) and sort by size decendingly?

查看:202
本文介绍了击:我怎么能列出每个文件和目录(递归)的大小,按大小排序decendingly?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现,有没有简单的获得方式的一个目录的大小击?

I found that there is no easy to get way the size of a directory in Bash?

我想,当我键入 LS - <有些选项>

它可以在同一时间,按大小次序递归和文件列出目录的文件大小的所有总和。

it can list of all the sum of the file size of directory recursively and files at the same time and sort by size order.

这可能吗?

推荐答案

只需浏览到目录并运行以下命令:

Simply navigate to directory and run following command:

du -a --max-depth=1 | sort -n

或添加-h人类可读的尺寸和-r,首先打印更大的目录/文件。

OR add -h for human readable sizes and -r to print bigger directories/files first.

du -a -h --max-depth=1 | sort -hr

这篇关于击:我怎么能列出每个文件和目录(递归)的大小,按大小排序decendingly?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆