Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
LemonWiki共筆
Search
Search
Appearance
Log in
Personal tools
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Linux commands
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== System disk space usage === hard disk usage * [http://linux.about.com/od/commands/l/blcmdl1_df.htm df command] "disk space usage" for {{Linux}} {{kbd | key = <nowiki>df -h</nowiki>}} * [http://linux.about.com/library/cmd/blcmdl1_du.htm du command] "estimate file space usage" of specific folder for {{Linux}} ** {{kbd | key = <nowiki>du -h /path/to/folder/</nowiki>}} Detailed output of hard disk usage of specific folder and child folders. e.g. {{kbd | key = <nowiki>du -h /home | sort -rn > ~/disk.txt</nowiki>}} ** {{kbd | key = <nowiki>du -hcs /path/to/folder/</nowiki>}} Brief output of total hard disk usage. ** {{kbd | key = <nowiki>du --max-depth=1 -B M /path/to/folder/ | sort -g</nowiki>}}<ref>[http://blog.xuite.net/chingwei/blog/32566618-%E3%80%90%E7%B3%BB%E7%B5%B1%E3%80%91%E4%BD%BF%E7%94%A8+du+%E4%BE%86%E7%9C%8B%E7%A3%81%E7%A2%9F%E7%9A%84%E4%BD%BF%E7%94%A8%E7%A9%BA%E9%96%93 【系統】使用 du 來看磁碟的使用空間 @ My Life :: 隨意窩 Xuite日誌]</ref>Output example: <pre> 0M /sys 1M /tmp 9M /run 27M /etc 36M /root 165M /boot 1647M /usr 49287M /var 51379M /home 102547M / </pre> [https://www.cyberciti.biz/faq/how-do-i-find-the-largest-filesdirectories-on-a-linuxunixbsd-filesystem/ How To Find Largest Top 10 Files and Directories On Linux / UNIX / BSD - nixCraft] {{exclaim}} It may costs time to return the result if there are too many file under the specified path. Output example of {{kbd | key = <nowiki>du -a -BM /path/to/folder/ | sort -n -r | head -n 10</nowiki>}}: <pre> # du -a -BM /var/ | sort -n -r | head -n 10 11199M /var/ 10384M /var/lib 6336M /var/lib/mysql 3714M /var/lib/strong-pm 3661M /var/lib/strong-pm/svc 2042M /var/lib/strong-pm/svc/1/work 2042M /var/lib/strong-pm/svc/1 1619M /var/lib/strong-pm/svc/2/work </pre> Options cited from the content of Linux man page<ref>[http://linuxcommand.org/lc3_man_pages/du1.html du man page]</ref> * {{kbd | key=<nowiki>-a, --all</nowiki>}} "write counts for all files, not just directories" * {{kbd | key=<nowiki>-B, --block-size=SIZE</nowiki>}} "scale sizes by SIZE before printing them"
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki共筆:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)