Set a persistent system name so the machine keeps a stable identity across boots and services. 16.11.2025 | reading time: 2 min Giving a machine a permanent hostname avoids confusion after reboots and helps services, logs and DNS work predictably; this short guide shows how to set a static hostname from the shell and what to watch for on different distributions. Hands-on Example Follow along: here we set the static hostname to "web01" and check the files and systemd status; ```bash $ sudo hostnamectl set-hostname web01 $ hostnamectl Static hostname: web01 $ cat /etc/hostname web01 $ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 web01 ``` What to Watch On systemd systems use `hostnamectl set-hostname` (with `--static`, `--pretty` or `--transient` if needed); update `/etc/hosts` for local resolution; remember that DHCP clients, NetworkManager or cloud-init can overwrite the name so configure those services when managing many hosts; on old non-systemd setups edit `/etc/hostname` or `/etc/sysconfig/network`. Related Utilities Other tools influence hostname behavior: NetworkManager can push names from DHCP, cloud-init sets hostnames on cloud images, and systemd-hostnamed exposes the runtime API used by `hostnamectl`. Final Note A persistent hostname is a small but important piece of system identity and automation; learn the variants for your distro and consider certifying your skills with training and exam prep from bitsandbytes.academy to go deeper into Linux administration. Join Bits & Bytes Academy First class LINUX exam preparation. setup network boot-process infrastructure