Archive

Posts Tagged ‘ssh’

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.

  1. Create a file .hosts in your home directory. In the file, put the hostnames of computers you commonly connect to, one per line.
    Example .hosts file:

    subdomain.domain.com
    computer.domain.com
  2. Add three lines to your .bashrc file:
    HOSTFILE=~/.hosts
    complete -f -A hostname scp
    complete -A hostname ssh
  3. Enter the command
    source ~/.bashrc

    to reload your settings.

Linux , ,