linux 查看磁盘空间

df

查看磁盘空间

1
2
3
4
➜  df -hl
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk0s2 112Gi 101Gi 11Gi 90% 26473262 2939106 90% /
localhost:/Zp5mvtzEO2n01q 112Gi 112Gi 0Bi 100% 0 0 100% /Volumes/MobileBackups

查看文件夹空间

1
2
➜  du -sh
61M .

查看当前目录下的各个目录、文件大小:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
➜  for i in $(ls -l |grep '^d' |du -s * |sort -nr|awk '{print $2}');do du -sh $i;done
15M 19550429.tar.gz
14M 19550994.tar.gz
14M 19550453.tar.gz
5.6M 19550447.tar.gz
3.9M 19550606.tar.gz
3.0M 19550597.tar.gz
1.5M 19553761.tar.gz
956K 19562246.tar.gz
632K 19585906.tar.gz
552K 19610713.tar.gz
396K 19587600.tar.gz
388K 19616004.tar.gz
332K 19568604.tar.gz
320K 19551176.tar.gz
196K 19567582.tar.gz
184K 19561990.tar.gz
112K 19562533.tar.gz
76K 19556528.tar.gz
72K 19595169.tar.gz
68K 19609459.tar.gz
16K 19724913.tar.gz
4.0K run.sh
4.0K 19585960.tar.gz

来源:http://leunggeorge.github.io/

blog-footer

0%