The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Ubuntu – changing hostname without rebooting

Posted by jpluimers on 2018/01/15

Assembled from various bits in [WayBackHow do I change the hostname without a restart? – Ask Ubuntu.

Assume your new host name is newHostName.

  1. edit /etc/hosts and replace the old hostname with newHostName
  2. Perform these commands:
    hostnamectl set-hostname newHostName
    exec bash
    hostname -f

Both the command prompt and the hostname output should show newHostName.

Note: if you get this when performing hostname -f then you forgot to edit /etc/hosts as per [WayBack] Just so everyone knows, the edit of /etc/hosts did the trick the 12.04 – Why I get hostname: Name or service not known error? – Ask Ubuntu:

hostname: Name or service not known

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.