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

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

-d, --domain

Display the name of the DNS domain.

-F, --file filename

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

-f, --fqdn, --long

Display the FQDN (Fully Qualified Domain Name).

-i, --ip-address

Display the IP address(es) of the host.

-s, --short

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

-V, --version

Print version information on standard output and exit successfully.

-v, --verbose

Be verbose and tell what's going on.

-y, --yp, --nis

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