Home » Questions » Computers [ Ask a new question ]

Finding what's using all the space in *nix

Finding what's using all the space in *nix

Which sequence of commands will tell me which files are the largest starting from a particular directory, including all sub directories? I want to know where all the space went.

Asked by: Guest | Views: 40
Total answers/comments: 5
Guest [Entry]

"I personally like to use du -sh * to see how big each directory is within the current directory.

Also you can sort to have bigger folders first: du -shx * | sort -hr. For du:

-s, --summarize: display only a total for each argument
-h, --human-readable: print sizes in human readable format (e.g., 1K 234M 2G)
-x, --one-file-system: skip directories on different file systems

For sort:

-h, --human-numeric-sort: compare human readable numbers (e.g., 2K 1G)"
Guest [Entry]

"basically you can use the du command. something like this

du -a /home | sort -rn |head -1

please look at the man page or info du for more options.

Or, you can use GNU find.

find /home/ -type f -printf ""%s:%p\n"" | sort -t"":"" -rn| head -1"
Guest [Entry]

"du -a | sort -n

would do the job. Using baobab (it's part of the gnome utils, so it's likely already installed on your system), you get a quite nice graphical breakdown of the used space."
Guest [Entry]

"Disk Usage Analyzer

If you're using a Debian/Ubuntu based distro there are a couple of GUIs available in the repositories, which you can find using synaptic."
Guest [Entry]

"du . -ha | sort -hr

-a, --all: write counts for all files, not just directories
-h, --human-readable: print sizes in human readable format (e.g., 1K 234M 2G)"