LinuxGem
此处为老的 LinuxGem,新版 LinuxGem 请移步 www.linuxgem.org

谁占了我的空间?

galeki posted @ 2008年9月21日 15:41 in 系统与硬件管理 with tags 硬盘 du ls ncdu baobab gdmap , 5790 阅读

虽然硬盘容量越来越大,但是我们也会觉得空间越来越不够用,只要有一条宽带线,再大的硬盘都能轻易塞满。

有的时候磁盘告急,需要马上清理出一块空间,但是怎么知道,是哪些文件占用了我的空间呢?

ls -sSh

ls -sSh 可以将当前目录下的文件按照大小排序显示出来,最大的放在前面,当前目录下的最大文件立马现形。

参数中的 S 即是按照大小排序,s 为顺带打印出文件大小,h 把大小显示为 xx K xx M 这样的易读格式,如果你只需要排序结果,那么 ls -S 就可以了。

du -s ./* | sort -rn

ls 只会列出文件,并不能计算目录大小,这时候就要靠 du 了。

du 的 -s 参数会告诉 du 只打印出每个文件或目录的总大小,而不要递归的把目录下所有文件的大小打印出来。然后再传给 sort,-n 为按照数字排序,-r 为逆序显示,这样最大的文件或者目录就列在前面了~

ncdu

ncdu 是一个基于 Ncurses 的小程序,可以显示某个文件夹下文件的空间占用统计,并且以直观的方式显示出来。

除了可以方便的浏览各个嵌套目录的空间占用之外,还可以在选中项目上,直接按 d 键删除。通过 ? 命令可以看到全部的命令列表。

你可以在 http://dev.yorhel.nl/ncdu/ 下载到 ncdu。

Baobab

Baobab 是 Gnome 附带的一个磁盘使用分析器。Baobab 可以将磁盘使用情况通过圆环图显示出来,各个目录以及他们的子目录占用空间的大小一目了然。并且,Baobab 也可以扫描远程的文件夹,甚至 ftp。

Gdmap

Gdmap 和 Baobab 概念相同,不过 Gdmap 是通过不同颜色的方格来展示各个目录的大小,不同类型的文件,比如视频、音乐、压缩包,会配以不同的颜色。 (多谢 xiws 补充 :)

你可以在 http://gdmap.sourceforge.net/ 下载到 Gdmap。

xiws 说:
2008年9月21日 19:06

没有gdmap的介绍么。。
这个也很不错的。。

Head_small
galeki 说:
2008年9月21日 20:35

多谢补充,已经加上了~

paddyfield 说:
2008年9月26日 04:34

一般用du -sh ,其他的用的比较少

shili 说:
2008年9月26日 18:54

一直用文件管理器的按大小排列……

Alex 说:
2008年10月02日 12:19

还有一个各平台通用的汇报工具JDiskReport还不错:
网络启动:
javaws http://www.jgoodies.com/download/jdiskreport/jdiskreport.jnlp

UPMSP 10th Question 说:
2021年10月01日 21:30

Students may also use the UP Board 10th 2022 for High School to help them prepare for the exam and achieve a high score. You can get the latest UP Board Model Paper 2022 for 10th Class from the subject-specific links provided above. UPMSP 10th Question Paper 2022 Students should download these papers and attempt to complete them within the time limit, as this will improve their writing skills.These UP High School Previous Papers 2022 Represent the Design of the Important Question Paper, Including the Types of Questions and the Mark Distribution Across Different Questions.

Goa HSSC Syllabs 说:
2022年7月09日 17:08

Goa Board of Secondary and Higher Secondary Education (GBSHSE) going to Soon Conducting 12th Class Study Class Academic year 2023, Every Year Goa Board 12th Class Join Thousands of Students, Goa 12thGoa HSSC Syllabs Class Study Class Start Every year Month of Jun, Goa Board of Secondary and Higher Secondary Education (GBSHSE) going to Soon Conducting 12th Class Study Class Academic year 2023, Every Year Goa Board 12th Class Join Thousands of Students, Goa


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter