Blogs Blogs

«Back

Tip of the day: bash-completion and SSH

shells/bash-completion is arguably the best friend of any lazy system administrator (as long as you're not hard-core FreeBSD fan enough to stick to tcsh). Did you know that it was actually 'completing' also the ssh(1) and scp(1) commands?

First of all, it is able to auto-complete the host name, as long as it is present in ~/.ssh/known_hosts. But, even more impressively, it also completes the directory and file names of the remote host - at the expense of some ssh traffic, of course.

And a word of warning here: if you enter wrong hostname, and then try to auto-complete a directory or file name, expect your shell to freeze for some time, while bash-completion is desperately trying to connect to the host.

Comments
Trackback URL: