Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: hostname completion for ssh / scp



Fourhundred Thecat wrote on Sat, Nov 05, 2016 at 19:54:29 +0100:
> > On 2016-11-05 18:24, Bart Schaefer wrote:
> > Well, yes.  The syntax of the /etc/hosts file is first an IP and then
> > a hostname.  Somebody will possibly correct me, but I don't recall
> > any valid use of /etc/hosts that has lines of host names without IPs.
> 
> Not true. IP address is not mandatory in /etc/hosts. You can leave it
> out, and only have hostnames.

The IP address is mandatory on both Linux and FreeBSD, according to
their respective hosts(5) man pages.

Does hosts(5) on your system make the IP address optional?  Or are you
simply saying that you put in /etc/hosts a line with no IP address, and
bash's hostname completion used hostnames from that line?

> This is useful for host autocompletion.
> You don't have to type a long hostname, such as:
> 
>   ssh long-or-complicated-host.my-subdomain.my-domain.com
> 
> instead, you just type
> 
>   ssh long<TAB>



Messages sorted by: Reverse Date, Date, Thread, Author