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.

Subscribe to My Newsletter

The latest programming-related news, articles and resources - sent to your inbox monthly. Unsubscribe anytime.