Today, we’ll go over a small tip involving how to modify the computer name, which you were able to set when you installed Ubuntu.
You might want to change the computer name for a number of reasons: Perhaps you want to shorten the name, or maybe there was a typo in the old computer name. Whatever it is, be sure to see the following instructions, which were tested in Ubuntu 10.10, a fun OS which we have explored here, although these will probably work for 10.04 too. For earlier editions or versions of Ubuntu, check these instructions that don’t require the use of the command line.
- First, press Alt-F2 to bring up the Run dialog. Type the following:
- and hit Run.
- Type your administrator password when you’re prompted, and click OK. You’ll see a gedit text editor window open, displaying your current computer name. Replace the text with your desired name. Remember to hit Ctrl+S to save your file before closing the file.
- Now bring up the Run dialog again by pressing Alt-F2. This time, type:
- If you get a prompt to type your administrator password, do so to proceed, but it’s possible you might not even get that prompt before the hosts file loads up in gedit. Now locate the last line of the first block of text and replace the text with the name you chose earlier. Hit Save when you’re done correcting.
- Close the file and restart the system. Once you’re back on your desktop, open a terminal window and verify that you have your new computer name at the header.
You should be all set if you use Ubuntu’s default web browser, Firefox. If however you use Google Chrome or Chromium, you may receive an error message that prevents the browser from opening after the system restart. I renamed the computer at least twice for this article and only got the error message after the first system renaming test.
If you did get the error message, read on.
- To get Google Chrome or Chromium up and running again, bring up the handy Run dialog again and type what’s next:
- Find and delete the SingletonLock file.
- Open up Google Chrome or Chromium as either one should now run like normal in your freshly-renamed computer.
Additional commenters from all over the web recommend doing “sudo hostname [NEW COMPUTER NAME]” on the terminal, which seems to only tease with a temporary change as the new name is nowhere to be seen after a reboot. I’ve also seen suggestions to restart the hostname service, but that hasn’t worked for me.
Do you know of other ways, perhaps more convenient ones or ones that don’t require a system restart, to change your computer’s name in Ubuntu? Share your nuggets of wisdom in the comments!