生活随笔
收集整理的這篇文章主要介紹了
du命令、df命令用法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、du命令
[plain]?view plaincopy print?
[root@wc1?mysql]#?du?--help??Usage:?du?[OPTION]...?[FILE]...????or:??du?[OPTION]...?--files0-from=F??Summarize?disk?usage?of?each?FILE,?recursively?for?directories.????Mandatory?arguments?to?long?options?are?mandatory?for?short?options?too.????-a,?--all?????????????write?counts?for?all?files,?not?just?directories??.......??
這個命令可以顯示每個文件的磁盤使用的概況,對于目錄還可以進行遞歸顯示里面的所有文件的情況。
?
舉例:
顯示當前目錄的總大小:
[plain]?view plaincopy print?
[root@ggg2?mysqldata]#?du?-s?-h?? 7.2G????.?? 顯示當前目錄中的所有子目錄、文件的大小,這里只取前10條:
?
[plain]?view plaincopy print?
[root@ggg2?mysqldata]#?du?-ah?|?head?-10?? 4.0K????./scripts/mysql_db_shutdown.sh?? 4.0K????./scripts/mysql_full_backup_by_xtra.sh~?? 4.0K????./scripts/mysqlplus.sh?? 4.0K????./scripts/mysql_env.ini?? 4.0K????./scripts/mysql_full_backup_by_xtra.sh?? 4.0K????./scripts/mysql_db_startup.sh?? 28K?./scripts?? 129M????./3306_cp/data/ib_logfile1?? 12K?./3306_cp/data/performance_schema/events_stages_current.frm?? 12K?./3306_cp/data/performance_schema/events_stages_history_long.frm?? ?
顯示子目錄backup的所有子目錄的明細匯總信息,還有一個額外的 total 值,類似sql 語句里的rollup效果:
[plain]?view plaincopy print?
[root@ggg2?mysqldata]#?du?-ch?backup?|?grep?total?? 2.4G????total?? 同上,只是這里的-0表示不換行顯示:
?-0, --null ? ? ? ? ? ?end each output line with 0 byte rather than newline
[plain]?view plaincopy print?
[root@ggg2?mysqldata]#?du?-c?-0h?backup??? 636K????backup/2016-10-16_21-47-35/performance_schema20K????backup/2016-10-16_21-47-35/ggg748K??backup/2016-10-16_21-47-35/test1.6M?backup/2016-10-16_21-47-35/mysql2.4G????backup/2016-10-16_21-47-352.3M??backup/mysql_full2.4G???b?? ?
二、df命令
?
[plain]?view plaincopy print?
[root@wc1?mysql]#?df?--help?? Usage:?df?[OPTION]...?[FILE]...?? Show?information?about?the?file?system?on?which?each?FILE?resides,?? or?all?file?systems?by?default.?? ?? Mandatory?arguments?to?long?options?are?mandatory?for?short?options?too.?? ??-a,?--all?????????????include?dummy?file?systems?? ......??
這個命令是顯示每個文件所駐留的文件系統的信息,默認是所有文件系統的情況。
舉例:
顯示每個分區的信息:
[plain]?view plaincopy print?
[root@ggg2?mysqldata]#?df?-h?? Filesystem??????Size??Used?Avail?Use%?Mounted?on?? /dev/sda3????????16G???13G??2.4G??85%?/?? tmpfs???????????936M??228K??936M???1%?/dev/shm?? /dev/sda1???????194M???36M??148M??20%?/boot??
顯示分區信息,包括虛擬文件系統:
[plain]?view plaincopy print?
[root@ggg2?mysqldata]#?df?-a?-h?? Filesystem????????Size??Used?Avail?Use%?Mounted?on?? /dev/sda3??????????16G???13G??2.4G??85%?/?? proc?????????????????0?????0?????0????-?/proc?? sysfs????????????????0?????0?????0????-?/sys?? devpts???????????????0?????0?????0????-?/dev/pts?? tmpfs?????????????936M??228K??936M???1%?/dev/shm?? /dev/sda1?????????194M???36M??148M??20%?/boot?? none?????????????????0?????0?????0????-?/proc/sys/fs/binfmt_misc?? vmware-vmblock???????0?????0?????0????-?/var/run/vmblock-fuse?? gvfs-fuse-daemon?????0?????0?????0????-?/root/.gvfs??
顯示inode的 信息,而不是磁盤的使用情況:
[plain]?view plaincopy print?
[root@ggg2?mysqldata]#?df?-i?-h?? Filesystem?????Inodes?IUsed?IFree?IUse%?Mounted?on?? /dev/sda3???????1015K??119K??896K???12%?/?? tmpfs????????????234K?????6??234K????1%?/dev/shm?? /dev/sda1?????????50K????39???50K????1%?/boot ? ?
轉載于:https://www.cnblogs.com/momogua/p/8304318.html
總結
以上是生活随笔為你收集整理的du命令、df命令用法的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。