若是要查看磁盘还剩多少空间,固然是用df的命令了。app
[root@localhost ~]# df -h .net
文件系统 容量 已用 可用 已用% 挂载点 get
/dev/sda2 14G 11G 2.6G 82% / class
/dev/sda1 99M 14M 81M 14% /boot test
tmpfs 442M 275M 168M 63% /dev/shm map
/dev/mapper/vg_test-lv_test grep
24M 1.3M 21M 6% /mnt/lvm im
[root@localhost ~]#统计
固然你可能并不关系磁盘还剩余多少空间,你是须要知道当前的文件夹下的磁盘使用状况:img
[root@localhost ~]# du --max-depth=1 -h
----------------------------------------------------------
第一种写法:
du -h --max-depth=1 img
du -h --max-depth=1 路径
第二种写法:
du -sh #统计当前目录的大小,以直观方式展示
------------------------------------------------------------
统计当前文件夹下文件的个数
ls -l |grep "^-"|wc -l