How to change a hostname in Ubuntu!

Created March 2, 2022

Introduction

Sometimes people want to change their ubuntu server name to something to go along with their project or something. Well, I will teach you how to do it without doing anything complicated!


Process

To begin, lets view the ubuntu hostname right now. Just type the following into the terminal:

hostname

It will show your hostname in the output, everyone's is different! Now lets change the hostname. The command is not that hard to type out so just copy/paste the command into your terminal:

hostnamectl set-hostname [new hostname]

Replace the [new hostname] with your new hostname. Do not include brackets or special characters in the hostname. Now that we changed the hostname, lets verify we changed it with the same command earlier:

hostname

You should get your new hostname you picked earlier. The final thing is to log-out then log back in to update the prompt.


Conclusion

There you go! Wasn't that hard at all! If you found this usful then please share this and follow me! Also check out Buy Me A Coffee below!

Buy Me A Coffee how2ubuntu