In today’s article, we’re going to learn how to change your hostname in Linux. It’s a pretty easy article to follow along with, so even if you’re a beginner you can follow along. If you’re an advanced user, you probably already know how to do this. If not, you will now.
So, what is your hostname? Basically, it’s the name of your computer (generally speaking). You login as
You can do some neat stuff with the hostname. For instance, and depending on the distro, it’s often local or localhost, you can connect to your LAN devices (without knowing the IP address) by connecting to
If you don’t know your hostname, you can use one of the following commands to figure it out:
Shell
Or you can try:
Shell
There are other ways to show the hostname, but those two should be enough to get you sorted out. Either of them will happily spit out the hostname. Now that you know your hostname, it’s time to learn how to …
Change Your Hostname:
Like so many other articles on this site, this one requires an open terminal to continue. So, just press
With your terminal open, enter the following command:
Shell
That should permanently change your hostname to the new hostname you chose to use in the command. You can actually change it temporarily, it will not be persistent between reboots, with the hostname command. to do that you’d just sudo hostname
and it’ll change it for the current session only.
To verify that you’ve changed your hostname, run one of the commands listed in the preamble section of this article. (Just type hostname
and to verify you know how to change your hostname.)
Anyhow, that’s all there is to it. You really don’t need anything more than that if you want to change your hostname in Linux. Anyone should be able to follow the few directions needed.
Closure:
There you have it, another article. To think, we’re over 200 articles now. This is just one more among many, and this one is easy enough to follow. If you ever wanted to change your hostname, now you know…