Skip to content

Instantly share code, notes, and snippets.

@JCotton1123
Last active December 30, 2015 01:59
Show Gist options
  • Save JCotton1123/7759674 to your computer and use it in GitHub Desktop.
Save JCotton1123/7759674 to your computer and use it in GitHub Desktop.
Linux CLI snippets
## All IPs
egrep -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
## Find a distinct list of file exts within a specified directory
find ./ -type f -name "*.*" -exec basename {} \; | rev | cut -d. -f 1 | sort | uniq | rev
## Find files with the supplied exts (linux)
find ./ -regextype posix-extended -regex ".*(mp3|mp4|pdf|PDF|doc|zip|ZIP|wav|gz)$"
## Find files with supplied exts (mac)
find -E ./ -regex ".*(tar|wav|wav|wmv|wmv|xls|zip)$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment