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,373 other followers

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

 
%d bloggers like this: