[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: localhost in /etc/hosts



On 2006-11-22 13:41:22 +0100, David Jardine wrote:
> On Wed, Nov 22, 2006 at 12:17:03AM +0100, Vincent Lefevre wrote:
> 
> > Well, the result of the hostname command depends on the /etc/hosts
> > file and if your configuration is incorrect, it may not give you a
> > consistent result.
>  
> Not here.  It uses the /etc/hostname file.  I changed the entry in 
> /etc/hostname to "jim", rebooted, and was greeted with 

"hostname" without argument uses /etc/hostname (via the gethostname(2)
function), but if you give the --fqdn option, resolver(3) will be used
too, i.e. /etc/resolv.conf and/or /etc/host.conf files, as documented
in these man pages. "hostname -s" seems to return the short host name
corresponding to the FQDN (but the hostname(1) man page is not clear).

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



Reply to: