Change hostname on Ubuntu


2015-07-23 · 1 min read

Before Ubuntu 13.04 you could use hostname command along with changing host names in /etc/hosts. Now, you can use hostnamectl which comes as a part of the systemd-services package, which is installed by default.

sudo hostnamectl set-hostname <new-hostname>

Unfortunately, you must to separately adjust /etc/hosts.

My Tech Newsletter

Get emails from me about programming & web development. I usually send it once a month