hostname — machine names and resolution
cheat sheet · Ubuntu 24.04; hostname 3.23+nmu2ubuntu2 https://lab.dimsanych.ru/en/wiki/hostname/Cheat sheet
-
hostnamecurrent name -
hostname -sshort name -
hostname -fresolved FQDN -
hostname -iname-derived addresses -
hostname -Iinterface addresses -
hostname --versionutility version
Options
Option case matters: -i resolves addresses for the host name, whereas -I enumerates interface addresses without relying on resolution of that name. The -I result excludes loopback and IPv6 link-local addresses; order is not guaranteed. Neither option means “public IP”.
-F reads a name from a file and changes state. A plain hostname operand also sets
the current node name. For persistent Ubuntu configuration, use hostnamectl and
check local name resolution.