hostname

v0.0.28
hostname [OPTION]... [HOSTNAME]

Display or set the system's host name.

Options

--domain, -d

Display the name of the DNS domain if possible

--ip-address, -i

Display the network address(es) of the host

--fqdn, -f

Display the FQDN (Fully Qualified Domain Name) (default)

--short, -s

Display the short hostname (the portion before the first dot) if possible

Examples

Show current host name:

hostname

Show the network address of the host name:

hostname -i

Show all network addresses of the host:

hostname -I

Show the FQDN (Fully Qualified Domain Name):

hostname --fqdn

Set current host name:

hostname {{new_hostname}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.