Device or system hostnames are used to easily recognize a machine within a network in a human readable format. It is not much of a surprise, but on Linux system, the hostname can be easily changed by using simple command as “hostname“.
Running hostname on its own, without any parameters, will return the current hostname of your Linux system like this:
If you want to change or set hostname of your Linux system, simply run:
Of course, you will need to replace “NEW_HOSTNAME” with the actual hostname that you wish to set. This will change the hostname of your system immediately, but there is one problem – the original hostname will be restored upon next reboot.