JavaScript is required to view this page.
Skip to content
Home Assistant Voice Bundle Deals!
Home Assistant Voice Bundle Deals!
How-To: Change the Hostname of your Linux System From the Command Line

How-To: Change the Hostname of your Linux System From the Command Line

While setting up our Clusterboard with SOPine modules, we wanted to give each SOPine module its own name to make it easier to identify. Here's how to do that from the command line, and this should work for most Debian-based distros:

sudo nano /etc/hostname

Replace the current hostname with the new hostname that you want and save the file. Next:

sudo nano /etc/hosts

Find all occurrences of the current hostname and replace them with the new hostname that you set in /etc/hostname.

Reboot, and you're done!

Additional notes from Robbie Ferguson of Category5.tv:

Should also type: hostnamectl set-hostname _newname_

Here's a clean way: https://github.com/Cat5TV/linux-tools/blob/master/change-hostname

It has been mentioned that using the hostnamectl method in place of the step involving editing /etc/hostname above does not require a reboot. Let us know what your experiences are.
Previous article Ubuntu Touch OTA-3 Unleashes New Features for Mobile Linux Enthusiasts

Leave a comment

Comments must be approved before appearing

* Required fields

x