The hostname
command in the Debian Almquist Shell (dash) is used to display or set the system’s hostname. The hostname is a label that identifies a device on a network, making it easier to manage and communicate with other devices.
The basic syntax of the hostname
command is as follows:
hostname [options] [arguments]
-f
, --fqdn
: Display the fully qualified domain name (FQDN) of the system.-i
, --ip-address
: Show the IP address associated with the hostname.-s
, --short
: Display the short hostname (the part before the first dot).-V
, --version
: Show the version of the hostname command.Here are some practical examples of using the hostname
command:
hostname
hostname -f
hostname -s
hostname -i
sudo hostname new-hostname
-f
option to ensure you are aware of the full network identity of your machine.