hostname

Name

hostname -- show the system's host name

Synopsis

hostname [-v] [-a] [--alias] [-d] [--domain] [-f] [--fqdn]
[-i] [--ip-address] [--long] [-s]  [--short]  [-y]  [--yp]
[--nis]

hostname [-v] [-F filename] [--file filename] [hostname]

hostname [-v] [-h] [--help] [-V] [--version]

Description

hostname is used to either set or display the current host or domain name of the system. This name is used by many of the networking programs to identify the machine. The domain name is also used by NIS/YP.

When called without any arguments, the program displays the name of the system as returned by the gethostname(2) function.

When called with one argument or with the --file option, the commands set the host name or the NIS/YP domain name. Note, that only the super-user can change the names.

Options

-a, --alias

displays the alias name of the host (if used).

-d, --domain

displays the name of the DNS domain.

-F, --file filename

reads the host name from the specified file. Comments (lines starting with a #) are ignored.

-f, --fqdn, --long

displays the FQDN (Fully Qualified Domain Name).

-i, --ip-address

displays the IP address(es) of the host.

-s, --short

displays the short host name. This is the host name cut at the first dot.

-V, --version

prints version information on standard output and exits successfully.

-v, --verbose

tells what's going on.

-y, --yp, --nis

displays the NIS domain name. If a parameter is given (or --file name) then root can also set a new NIS domain.