Hostname funniness

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

On Wed, 2004-11-17 at 12:49 +0000, Lorenzo E. Danielsson wrote:
> Ubuntu (Hoary):
> % hostname
> % 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
$ hostname -s
$ hostname --fqdn
$ cat /etc/hostname
$ cat /etc/hosts	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