RE: SSH Tab Complete
December 5th, 2009 | Published in Tutorial | 6 Comments
This is a response to SSH Tab Complete by Michael Lustfield.
Create a ~/.ssh/config file and populate it with configurations. Doing this is the only step you need to do, and you don’t need to add anything to your ~/.bashrc. Example ~/.ssh/config:
# foobar.com Host foobar Hostname foobar.com User xxxxxxxxxxxxx # Home server (internal) Host iserver Hostname 10.0.0.2 User xxxxxxxxxxxx Port ####
Host is a simple word that will be used with ssh like ssh foobar. Hostname is the actual IP address of domain name of the server. User is your username for that machine. Port is the ssh port number, if it isn’t the default port of 22.
So, when I want to ssh into my home server, I just do ssh is, press tab, then enter. There are many more options to add to the config file as well, and a simple Google search will provide more. Also man ssh_config will give you pretty much everything you need as well.





December 5th, 2009 at 18:13:47 (#)
Better is to uncomment bash completion, in /etc/bash.bashrc:
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
Add the following to /etc/ssh/ssh_config:
HashKnownHosts no
December 5th, 2009 at 18:47:48 (#)
better,
neither my 8.04 LTS box nor my debian lenny box has an /etc/bash_completion anymore
there’s /etc/bash_completion.d/ though, but my old script, nearly like yours, doesn’t work anymore
nixternal,
I’d love to hear some details about your setup then, because I can’t reproduce that on said 8.04 box, even with a fresh user with no modifications to .bashrc or environment variables at all
December 5th, 2009 at 19:05:12 (#)
@better – even better is zsh
@Florian – Did you try it after a reboot or a logout/login? I am not using 8.04, but on a fresh install of 9.10, it worked for me. I do not use bash as I use zsh, but on a fresh install, the default shell is dash, and it just worked for me.
December 6th, 2009 at 07:31:49 (#)
Ah yes, forgot:
sudo apt-get install bash-completion
http://bash-completion.alioth.debian.org
December 6th, 2009 at 18:14:50 (#)
[...] RE: SSH Tab Complete [...]
December 12th, 2009 at 15:23:01 (#)
Wow. I already have a ~/.ssh/config for my convenience, but I didn’t know it did that. Cheers!