Most network-capable operating systems require that the computer upon which they are installed be assigned a name. Since computers on networks are termed hosts, this name is usually called the hostname. If a group of computers share a network, they usually must have distinct hostnames; because of this, hostnames often become very creative on large networks.

Under Unix and related systems, you must assign a hostname even if your computer is not on a network. If it is on an IP network such as the Internet, the hostname should correspond to the computer's DNS name. It is recommended that the hostname be the same as the fully-qualified domain name, e.g. cthulhu.miskatonic.edu; however, it remains common to use only the first component, e.g. cthulhu. The hostname is set during the boot process. The configuration file in which it is stored varies from system to system; examples include /etc/hostname, /etc/myname, or /etc/sys_id.

Under desktop operating systems such as Mac OS and Windows, there is often no need to assign a hostname unless the computer is on a network. Also, while both Mac OS and Windows are Internet-capable, neither requires nor particularly expects that the hostname correspond to the DNS name. This is because both use hostnames primarily for file sharing, and neither historically used DNS to resolve file-sharing names. The hostname of a Mac OS system is set in its File Sharing (or Sharing Setup) control panel; the hostname of a Windows system is set in the Network control panel.

Mac OS X is an odd case, as it incorporates aspects of Mac OS, BSD Unix, and NeXTstep. A Mac OS X system's Unix-style hostname is set in /etc/rc.boot, and is configured by default to the unimaginative localhost. Its Mac-OS-style hostname — i.e. its AppleTalk "computer name" — is set in the Sharing preferences panel. It also has a NeXT-style NetInfo name, set in either the local NetInfo directory or that of the network to which it is connected.


Many operating systems provide a default hostname, if the user or administrator administrator does not specify one. The Macintosh default AppleTalk name is Joe User's Computer, with the name Joe User replaced by the primary user's full name. The default hostname under Debian is debian; under Red Hat Linux it's localhost.localdomain; and under Slackware it is darkstar.example.net. The default hostname of a Windows PC depends on the OEM — but its default NetBIOS workgroup is WORKGROUP.