Linux 查看磁盘空间

时间:2021-05-24 15:43:46   收藏:0   阅读:17

df

df 以磁盘分区为单位查看文件系统,可以获取硬盘被占用了多少空间,目前还剩下多少空间等信息。

例如,我们使用df -h命令来查看磁盘信息, -h 选项为根据大小适当显示:

技术分享图片

显示内容参数说明:

相关命令:

du

du 的英文原义为 disk usage,含义为显示磁盘空间的使用情况,用于查看当前目录的总大小。

例如查看当前目录的大小:

# du -sh
605M    .

显示指定文件所占空间:

# du -h log2012.log 
300     log2012.log

方便阅读的格式显示test目录所占空间情况:

# du -h test
608K    test/test6
308K    test/test4
4.0K    test/scf/lib
4.0K    test/scf/service/deploy/product
4.0K    test/scf/service/deploy/info
12K     test/scf/service/deploy
16K     test/scf/service
4.0K    test/scf/doc
4.0K    test/scf/bin
32K     test/scf
8.0K    test/test3
1.3M    test

du 命令用于查看当前目录的总大小:

案例

[root@hadoop1 home]# du -h img2text/  (查看当前目录的总大小)
8.4G    img2text/logs
11G    img2text/
[root@hadoop1 img2text]# du -h  nohup.log (查看当前文件的总大小
2.1G    nohup.log

 

原文:https://www.cnblogs.com/luweiweicode/p/14803714.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!