Press "Enter" to skip to content

Month: October 2013

Poor man’s ssh launcher (CLI)

Problem: just wanted an easy way to add my hosts to the ssh config file and connect to each host through the easiest way possible using normal bash command-line. Solution: configure your .ssh/config like you normally would, with the following: Host myapache Hostname myapache.host.com User fred Host myapache2 Hostname myapache2.host.com User fred Add the following to your .bashrc or .bash_profile (Mac OS X): shosts=`grep ‘Host ‘ ~/.ssh/config | awk ‘{print $2}’` for h in $shosts ; do alias $h=”ssh $h” ; done alias ssh-hosts=’echo -e $shosts | tr ” ” “n”‘ And voilá, if you want to connect to any…

Leave a Comment