hostnamectl
The command that shows and sets the machine's host name, including the static name kept across reboots.
In more detail
hostnamectl set-hostname writes /etc/hostname. The plain hostname command sets only a transient name that the next boot forgets.
Example
hostnamectl set-hostname servera.lab.example.comRelated terms
- DNS — The system that turns names such as learnsome.tech into IP addresses.
Taught in
- Host Names And Name Resolution — Red Hat Certified System Administrator (EX200) Exam Prep
- Mock Exam, Part 1: Eighteen Tasks, One Reboot — Red Hat Certified System Administrator (EX200) Exam Prep
- Mock Exam, Part 2: Real Machines And The Ten Costly Mistakes — Red Hat Certified System Administrator (EX200) Exam Prep
- A Server Nobody Can Find: Addresses, Routes And Names On Both Families — CompTIA Linux+ (XK0-006) Exam Prep
- Down Until Morning: Unit Files, Drop-ins, Masks And systemd's Helpers — CompTIA Linux+ (XK0-006) Exam Prep