Probably only works with GNU du and modern perls. Show Sample Output
Very useful when you need disk space. It calculates the disk usage of all files and dirs (descending them) located at the current directory (including hidden ones). Then sort puts them in order.
Recursively searches current directory and outputs sorted list of each directory's disk usage to a text file. Show Sample Output
Taken from here: http://linsovet.com/directory-usage-size-sorted-list Show Sample Output
ncdu is a text-mode ncurses-based disk usage analyzer. Useful for when you want to see where all your space is going. For a single flat directory it isn't more elaborate than an du|sort or some such thing, but this analyzes all directories below the one you specify so space consumed by files inside subdirectories is taken into account. This way you get the full picture. Features: file deletion, file size or size on disk and refresh as contents change. Homepage: http://dev.yorhel.nl/ncdu Show Sample Output
Since coreutils 7.6 provides sort -h Show Sample Output
No need to type out the full OR clause if you know which OS you're on, but this is easy cut-n-paste or alias to get top ten directories by singleton. To avoid the error output from du -xSk you could always 2>/dev/null but you might miss relevant STDERR.
Based on the MrMerry one, just add some visuals to differentiate files and directories
Based on the MrMerry one, just add some visuals and sort directory and files
This command is useful for finding out which directories below the current location use the most space. It is summarised by directory and excludes mounted filesystems. Finally it is sorted by size. Show Sample Output
Sort disk usage from directories in the current directory Show Sample Output
A little bit smaller, faster and should handle files with special characters in the name.
this requires the use of a throwaway file. it outputs a shell function. assuming the throwaway file is f.tmp usage: >f.tmp;lso f.tmp > f.tmp; . f.tmp;rm f.tmp;lso -l ... notes: credit epons.org for the idea. however his version did not account for the sticky bit and other special cases. many of the 4096 permutations of file permissions make no practical sense. but chmod will still create them. one can achieve the same sort of octal output with stat(1), if that utility is available. here's another version to account for systems with seq(1) instead of jot(1): lso(){ case $# in 1) { case $(uname) in FreeBSD) jot -w '%04d' 7778 0000 7777 ;; *) seq -w 0000 7777 ;; esac; } \ |sed ' /[89]/d s,.*,printf '"'"'& '"'"';chmod & '"$1"';ls -l '"$1"'|sed s/-/./,' \ |sh \ |{ echo "lso(){"; echo "ls \$@ \\"; echo " |sed '"; sed ' s, ,@,2; s,@.*,,; s,\(.* \)\(.*\),s/\2/\1/,; s, ,,'; echo \'; echo }; }; ;; *) echo "usage: lso tmp-file"; ;; esac; } this won't print out types[1]. but its purpose is not to examine types. its focus is on mode and its purpose is to make mode easier to read (assuming one finds octal easier to read). 1. one could of course argue "everything is a file", but not always a "regular" one. e.g., a "directory" is really just a file comprising a list.
This approach deals with special characters such as apostrophe and whitespace in the file/directory names. tr '\n' '\0' converts the newline delimiting into NUL delimitering which xargs -0 expects. It works on systems which do not yet support xargs -d or sort -h, and includes files in addition to directories. Show Sample Output
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
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
Other solutions that involve doing
du -sx /*
are incomplete because they will still descend other top-level filesystems are that mounted directly at "/" because the * expands to explicitly include all files and directories in "/", and du will still traverse them even with -x because you asked it to by supplying the directory name as a parameter (indirectly via "*").
Show Sample Output
there is need of admin pack installed ( http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c16ae515-c8f4-47ef-a1e4-a8dcbacff8e3 )
biggest->small directories, then biggest->smallest files 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: