Produces the same, but without current directory size (.).
thanks to GREP_COLOR the output will highlite the first 4 digits. if all files are few MB only, this gives a quick overview of how many powers of 10 bigger than 1MB they really are, a logarithmic scale. same works if files are more than 1GB when you replace the "4" by a "7", I usually use "5" in order to manually decide what files to delete...
list the file size of files in a directory from largest to smallest. Good for finding whats taking up all your harddrive space.
This command summarizes the disk usage across the files and folders in a given directory, including hidden files and folders beginning with ".", but excluding the directories "." and ".." It produces a sorted list with the largest files and folders at the bottom of the list Show Sample Output
Removes directories which are less than 1028KB total. This works for systems where blank directories are 4KB. If a directory contains 1 MB (1024KB) or less, it will remove the directory using a path relative to the directory where the command was initially executed (safer than some other options I found).
Adjust the 1028 value for your needs.
It would be helpful to test the results before proceeding with the removal. Simply run all but the last two commands to see a list of what will be removed:
du | awk '{if($1<1028)print;}' | cut -d $'\t' -f 2-
If you're unsure what size a blank folder is, test it like this:
mkdir test; du test; rmdir test
# displays 10 largest files and folders in bytes # last entry is largest # similar output to this: du -sk * | sort -nr | head Show Sample Output
can be pointed at specific files using:
du -ahc /path/to/file
counting only directories is faster:
du -hc .
sort - sort lines of text files -n, --numeric-sort compare according to string numerical value du - estimate file space usage -a, --all write counts for all files, not just directories -k like --block-size=1K -x, --one-file-system skip directories on different file systems Show Sample Output
A sure-fire way to find what's taking too much space in a filesystem. Use tail to get just the biggest files instead of all. Show Sample Output
get the size of S3 bucket Show Sample Output
list all directory sizes and sort by size
Give the space freed before delete files. Only delete files go to free space. Files with mora than 1 link, don't free space. Show Sample Output
Shows the size of folders and files, sorted from highest to lowest in human format (gb, mb,kb,etc...) Very useful to see the folders that are occupying more space. Show Sample Output
For example to add up the disk usage at several disjoint locations. The $[..] is for arithmetic evaluation in bash. Alternatively pipe to the bc command. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: