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 swift move
$ sed -i 18d .ssh/known_hosts
  • Whats my WAN IP?
$ dig +short myip.opendns.com @resolver1.opendns.com
  • Math on the cli
Basic operations

$ echo $((1+1))
2
$ echo $((3-1))
2
$ echo $((4/2))
2
$ echo $((1*2))
2

Floating point calculations

$ echo "2*2.2/2.2" | bc
2

$ echo "4.4+7/8-(4.74*3.14)" | bc
-10.48
bash_oneliners.1444307466.txt.gz · Last modified: 2015/12/19 14:59 (external edit)