df -h ,这个命令用于查看服务器空间,运行后的效果图如下:
[root@localhost /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 8.3G 5.4G 2.9G 66% / devtmpfs 911M 0 911M 0% /dev tmpfs 921M 0 921M 0% /dev/shm tmpfs 921M 8.4M 912M 1% /run tmpfs 921M 0 921M 0% /sys/fs/cgroup /dev/sda1 497M 164M 334M 33% /boot www 274G 166G 108G 61% /www phpwww 197G 15G 183G 8% /phpwww vagrant 274G 166G 108G 61% /vagrant tmpfs 185M 0 185M 0% /run/user/0 [root@localhost /]#
du -h --max-depth=1,这个命令用于查看当前目录,哪个文件占用最大,运行效果如下:
[root@localhost /]# cd /usr/local/ [root@localhost local]# du -h --max-depth=1 0 ./bin 0 ./etc 0 ./games 0 ./include 0 ./lib 0 ./lib64 0 ./libexec 0 ./sbin 4.0K ./share 0 ./src 385M ./jdk1.8 524M ./es 297M ./jdk11 1.1G ./kibana7.5.1 319M ./logstash 76M ./filebeat 2.7G . [root@localhost local]#