How to change the computer name in elementary OS

So you have installed elementary OS in a hurry only to realize you made a typo or gave a weird name or left the default name having the PC maker and model for the computer name. You didn’t bother it much until you start seeing it in the Terminal’s command prompt! Don’t worry, it is easy to change the computer name. We shall edit the host name in the system file using gedit command.

STEP 1: Go to ‘Applications’ and launch ‘Terminal’.

STEP 2: Type the following command line and hit enter.

sudo gedit /etc/hostname

Terminal gedit command
Terminal gedit command

As you see, we are using gedit to edit the hostname file.

STEP 3: You will see a new window with the current computer name in it. In my test PC, the name is ‘FOSSLinux’. I will change it to ‘PC_NAME_CHANGE’ just for the sake of illustration. You can enter whatever the new name you want.

STEP 4: Click ‘Save’.

gedit_hostname
gedit_hostname

STEP 6: Finally, update the new name in the hosts file too in similar way with the following command. (Thanks to cleteman)

sudo -i gedit /etc/hosts

STEP 7: Close everything and restart the computer.

STEP 8: Launch ‘Terminal’ to see your new computer name in the command prompt.

Computer_Name_Changed
Computer_Name_Changed

Kiran Kumar
Hi there! I'm Kiran Kumar, founder of FOSSLinux.com. I'm an avid Linux lover and enjoy hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. Hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more, and spread Linux love!. If you find a time, drop me an email or feedback from the 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!

3 COMMENTS

  1. One more step:
    Update the /etc/hosts file with the new hostname.
    Other wise you will get an “unable to resolve host” msg when using su or sudo cmd.

Leave a Reply to cleteman Cancel reply

Please enter your comment!
Please enter your name here

STAY CONNECTED

24,108FansLike
213FollowersFollow
7SubscribersSubscribe

LATEST ARTICLES

How to create a Fedora Games Live USB drive in Linux

One of the best Fedora spins that has been for a while and also being well maintained is the Fedora Games. The Fedora Games spin is a great showcase of the best games available in the Fedora operating system.
clipboard manager linux
We have all had that moment when we copied a text, but we first needed another one, and in the process, lost the first one. If you're lucky, you can get it back quickly with a bit of work.
best video players for linux
Most Linux-based systems come with a built-in video player, but let's be honest, it most definitely won't be able to satisfy all of your requirements, due to the fact that default software is mostly made for basic purposes. In this article, we will review the 5 Best Video Players for Linux and thoroughly discuss their features as well as their pros and cons.
Linux Lite 4.8 desktop tour video
Linux Lite eases Windows 7 users transition to Linux much more comfortable by offering simple software like Team Viewer, VLC, Firefox, TimeShift backup utility, and a full Microsoft Office compatible office suite in LibreOffice.