Where to start First steps track · 15 stages
Linux Labs

hostname — machine names and resolution

cheat sheet · Ubuntu 24.04; hostname 3.23+nmu2ubuntu2 https://lab.dimsanych.ru/en/wiki/hostname/

Cheat sheet

  • hostname current name
  • hostname -s short name
  • hostname -f resolved FQDN
  • hostname -i name-derived addresses
  • hostname -I interface addresses
  • hostname --version utility 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.

Loading…