Hostname funniness

Dennis Kaarsemaker dennis at kaarsemaker.net
Wed Nov 17 07:48:19 CST 2004


On Wed, 2004-11-17 at 12:49 +0000, Lorenzo E. Danielsson wrote:
> Ubuntu (Hoary):
> % hostname
> my.hostname.net
> % hostname -s
> localhost

My quess is that hostname (or the gethostname() function) reads the
description from /etc/hostname

hostname -s or hostname --fqdn read their data from /etc/hosts

For me this happens:
$ hostname
raptor
$ hostname -s
localhost
$ hostname --fqdn
localhost.localdomain
$ cat /etc/hostname
raptor
$ cat /etc/hosts
127.0.0.1	localhost.localdomain	localhost	raptor

Reading the manpage for hostname confirms this.
-- 
Dennis K.
  And that's the way the cookie crumbles!




More information about the ubuntu-devel mailing list