See
BLT.
/etc/HOSTNAME: Possibly the canonical (
DNS) name of the local host
On many forms of UNIX and Linux this will be a single line text file containing the machine's canonical (official) hostname (as used by
DNS or in /etc/hosts files).
The file can contain the FQDN (fully qualified domain name) (foo.example.com) or the short hostname (foo). There is no dominant standard on this, and it is a commonly debated point on some newsgroups and mailing lists.
On some systems it may appear as /etc/hostname (all lowercase). On Red Hat and similar systems the real hostname may be a setting in the /etc/sysconfig/network file. (Reading through the start up scripts, particulary /etc/init.d/rc.sysinit on a Red Hat system suggests that the hostname is set and reset several times during the boot sequence based on different criteria --- this is probably an historical artifact).
In general the host's name is found in some file and set using the
hostname command. This can be seen with the command ''uname -n'' (--nodename) on a Linux system. Ultimately the hostname is set by the startup scripts, so it might differ from one distribution to another. Various programs may use various different ways to get the local hostname --- probably the best would be to use the ''uname()'' system call.
Contributors
- () JimDennis - 22 Oct 2003
- If you edit this page: add your name here; move this to the next line; and if you've used a comment marker (your initials in parenthesis), include it before your WikiName.
Revision Comment
Page Ratings