Name

hostname

Synopsis

hostname [option] [nameofhost]

Set or display name of current host system. A privileged user can set the hostname with the nameofhost argument.

Options

-a, --alias

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

-d, --domain

Display DNS domain name.

-f, --fqdn, --long

Display fully qualified domain name.

-F file, --file file

Consult file for hostname.

-h, --help

Display a help message and then exit.

-i, --ip-address

Display the IP address(es) of the host.

-s, --short

Trim domain information from the display output.

-v, --verbose

Verbose mode.

-V, --version

Display version information and then exit.

-y, --yp, --nis

Display the NIS domain name. A privileged user can set a new NIS domain name with nameofhost.

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.