Back to the command reference

hostname

SystemBeginner In simulator In real Linux

Show or set the host name

Name: hostname: host name

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

hostname shows or temporarily sets the system's host name, the machine's name on the network. A name set this way is lost on reboot; use hostnamectl set-hostname to change it permanently.

Syntax

hostname [NAME]

Common options

-IShow all IP addresses of the host
-iShow the addresses the host name resolves to
-sShow the short name (up to the first dot)
-fShow the fully qualified domain name

Examples

Related