A system hostname is, put simply, a computer's name. This name is used to identify and access it on both local and global networks if a fully qualified domain name is set.
hostname is also a command which can be used to display and change the computers hostname.
HOWTO change a computers hostname[edit | edit source]
A machines hostname can be changed in a huge variety of ways which all end up changing the configuration file
/etc/hostname which is where the machines hostname is specified. This file has historically only contained the actual machine's name (like "
chaekyung") and not the fully qualified domain name (like "
hostnamectl[edit | edit source]
systemd enabled distributions (most of them) have a command called
hostnamectl which will display the system hostname as well as a lot of incriminating information when it's ran without an argument. It has the option
set-hostname with takes a hostname as an argument. Thus; if you want to change your hostname to
yoona you can run this command:
sudo hostnamectl set-hostname yoona
hostnamectl will change the system's run-time hostname and make the new hostname permanent by writing it to the configuration file
the good old manual way[edit | edit source]
hostname will let you change the runt-ime hostname by running it with a new host name as an argument:
sudo hostname yoona
will change the hostname to
yoona at run-time but it will not make it permanent by changing
/etc/hostname. The change will be lost after a reboot.
Making a hostname change is a simple matter of editing the
which means it can be changed by simply writing a new hostname to that file:
sudo sh -c "echo yoona > /etc/hostname"
|Note: The above command runs |