Host foo HostName foo.example.com ForwardX11 no
If you have the above in your
~/.ssh/config file, you can simply type
ssh foo instead of
ssh -x foo.example.com.
It’s pretty much always the case that I’ll fire up
when SSHing into a remote host. Here’s some code
that’s been banging around in my
.cshrc for a few years. It
sets up handy shell aliases for all of the machines I commonly
set ssh_hosts=`grep '^Host [^*]' ~/.ssh/config|cut -c 6-` foreach host ($ssh_hosts) alias $host "ssh -t $host screen -DR" end
Now I can simply type
I’ll be up and running with a screen session on
foo.example.com. If I want to SSH into a
box without firing screen up, I simpy
ssh foo directly.
Now that we have this handy
ssh_hosts variable, we might as
well use it for other things too, like for adding intelligent
complete ssh 'p/1/$ssh_hosts/'
Now I can just type ssh f TAB RET and I’m good to go.