Tab Completion of SSH Hosts
August 28th, 2009
I was tired of having to type full hostnames every time I wanted to SSH to a computer I commonly use. So, I setup tab completion for hostnames when I use SSH or SCP. The process involved only 3 simple steps.
- Create a file
.hostsin your home directory. In the file, put the hostnames of computers you commonly connect to, one per line.
Example.hostsfile:subdomain.domain.com computer.domain.com
- Add three lines to your
.bashrcfile:HOSTFILE=~/.hosts complete -f -A hostname scp complete -A hostname ssh
- Enter the command
source ~/.bashrc
to reload your settings.