Skip to content

Instantly share code, notes, and snippets.

@morozgrafix
Last active August 29, 2015 14:14
Show Gist options
  • Save morozgrafix/00c4613ba3920fbb3729 to your computer and use it in GitHub Desktop.
Save morozgrafix/00c4613ba3920fbb3729 to your computer and use it in GitHub Desktop.
handy command line one liners

To find the largest 10 files (linux/bash): find . -type f -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

To find the largest 10 directories: find . -type d -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

Only difference is -type {d:f}.

Source: http://superuser.com/questions/9847/linux-utility-for-finding-the-largest-files-directories

Get a list of all of the distinct file extensions within directory: find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u

Source: http://stackoverflow.com/questions/1842254/how-can-i-find-all-of-the-distinct-file-extensions-in-a-folder-hierarchy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment