Updated 28-Jun-2024
How to set and modify hostnames
Contents
hostname commands
hostname
andhostnamectl
will display the static, transient hostnames (hostnamectl
also provides other host information).sudo nano /etc/hostname
can be used to edit the hostname that will be displayed upon reboot or restart.- This can be done more easily from the command with
sudo hostnamectl set-hostname NEWNAME
- This can be done more easily from the command with
Edit hosts file
sudo nano /etc/hosts
Add the hostname after localhost
for local DNS lookup