linux命令-du查看占用磁盤空間大小


 

格式

df -h 查看磁盤分區情況

du /etc 目錄文件大小都列出來 單位是k最后一行是總和

du -m 單位是m 小於1m寫成1m

du -h 單位人性化顯示k/m

du -sh /etc 查看指點目錄/文件大小

//////////////////////////////////////////////////////////////////////////////////////

du查看和ls查看區別

[root@wangshaojun ~]# du -sh /etc/init.d/iptables
12K /etc/init.d/iptables                         
[root@wangshaojun ~]# ls -lh  /etc/init.d/iptables
-rwxr-xr-x. 1 root root 11K 7月  24 10:08 /etc/init.d/iptables ///////du-12k ls-11k

轉換成k為單位

[root@wangshaojun ~]# ls -lb  /etc/init.d/iptables
-rwxr-xr-x. 1 root root 11048 7月  24 10:08 /etc/init.d/iptables
[root@wangshaojun ~]# du -sb /etc/init.d/iptables
11048 /etc/init.d/iptables   ////////ls-11048b  du-11048b 一樣的

////////////////////////////////////////////////////////////////////////////////////////////////////

[root@wangshaojun ~]# touch /tmp/1.txt
[root@wangshaojun ~]# echo "12">>/tmp/1.txt
[root@wangshaojun ~]# ll /tmp/1.txt
-rw-r--r--. 1 root root 3 11月  6 19:35 /tmp/1.txt   /////真實大小
[root@wangshaojun ~]# du -sh /tmp/1.txt
4.0K /tmp/1.txt   /////占用磁盤塊的大小


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM