User Tools

Site Tools


bash_oneliners

This is an old revision of the document!


BASH oneliners

  • Remove offending key from known_hosts file with one command
$ sed -i 18d .ssh/known_hosts
  • Whats my WAN IP?
$ dig +short myip.opendns.com @resolver1.opendns.com
  • Find large files, print 10 largest files in dir
$ find . -printf '%s %p\n'|sort -nr|head
  • To find the largest file in all sub-directories:
$ find /path/to/folder -type f -exec ls -s {} \; | sort -nr | awk 'NR==1 { $1=""; sub(/^ /, ""); print }'
bash_oneliners.1450537157.txt.gz · Last modified: 2016/05/16 11:47 (external edit)