【linux】比較不錯的常用命令(長期維護)__linux

來源:互聯網
上載者:User

首先是對整個磁碟容量進行查詢的命令。

大家對於df是不陌生的,可以看到大概的佔用情況。

[root@slave2 ~]# dfFilesystem     1K-blocks    Used Available Use% Mounted on/dev/xvda1      41151808 7119776  31918600  19% /devtmpfs         1933472       0   1933472   0% /devtmpfs            1810080       0   1810080   0% /dev/shmtmpfs            1810080  196976   1613104  11% /runtmpfs            1810080       0   1810080   0% /sys/fs/cgroup

而du相關命令,則可以看到磁碟下佔用的大小。

[root@slave2 ~]# du -h --max-depth=1 /2.6M    /tmpdu: cannot access 鈥?proc/25459/task/25459/fd/4鈥? No such file or directorydu: cannot access 鈥?proc/25459/task/25459/fdinfo/4鈥? No such file or directorydu: cannot access 鈥?proc/25459/fd/4鈥? No such file or directorydu: cannot access 鈥?proc/25459/fdinfo/4鈥? No such file or directory0       /proc4.1G    /home193M    /run64M     /boot2.3G    /usr4.0K    /srv23M     /etc8.0K    /opt0       /dev100M    /root16K     /lost+found275M    /var4.0K    /media0       /sys4.0K    /mnt7.0G    /

除了深度還可以控制之外。還可以更改到任何路徑下面查詢對應層級的大小。
比如

du -m -h --max-depth=2 /usr/local | sort -nr

則為user/local下面深度為兩層的詳細大小。
同時用MB來表示大小。且整個資料以數位大小來進行從大到小的排序。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.