Sunday, June 15, 2008

Auto-complete hostnames with using bash

Having forever used tcsh, this is something new I discovered when I switched to bash.

Here's how it works:
prompt%>ssh my

Here's how to set it up:
1) Create a file similar to /etc/hosts

e.g: (/home/marke/hostfile)

# Local PC localhost
# Other

* note: you don't really seem to need the real IP address. Just the name. You ca even shorten it if you have resolver set correctly.

2) Add the following to your .bashrc

export HOSTFILE="/home/marke/hostfile"

Yor're done!


For more info:
* man bash
* link

No comments: