Finding the biggest files (Linux)

There are times when you need to find what is taking up the most space on your drives. The following will list the files in the current directory in order of file size.

ls -l | tr -s " " | cut -d" " -f 5,9 --output-delimiter=' ' | sort -k 1 -g

ls -l >lists all file info, including size.
tr -s " " >removes extra spaces so that each field is delimited by only one space.
cut -d" " -f 5,9 --output-delimiter=' ' >cuts out all but the 5th and 7th field (size and name) and replaces the delimiter with a tab (if you're typing rather than copying and pasting, type Ctrl-v, then hit the tab key.
sort -k 1 -g >Sorts by the files size.

For directories:
du --max-depth=1 | sort -k 1 -g

du --max-depth=1 >Lists sizes of directories attached to the current directory.
sort -k 1 -g >Sorts by file size.