Change the name of your computer on Ubuntu

From TheLinuxVault

Jump to: navigation, search


How-To
Change the name of your computer on Ubuntu
Image:Ubuntu.png


This how-to is about: Ubuntu, Networking

What you need to know to use this how-to:

This will explain how to change your computer's network name on Ubuntu and its derivatives.

[edit] Via GUI

  1. On the main menu, click System > Administration > Network
  2. Enter your password when prompted
  3. Click on the 'General' tab
  4. Change the setting called 'Host name'
  5. You will then need to log out and back in or possibly restart the computer

[edit] Via Terminal

Alternatively, this can easily be achieved from the terminal (command line).

  1. Open a terminal
  2. Enter the command hostname to receive your current hostname.
  3. Enter the command sudo hostname NEWNAME, where NEWNAME is your desired new hostname.

The change takes effect immediately, but the new name is lost once the machine is rebooted. This is due to the fact that Ubuntu reads the hostname for the system from the file /etc/hostname when the computer boots.

[edit] Via Text editor

To permanently change your hostname from the command line use your favorite text editor to edit the file /etc/hostname (the following example uses vi).

  1. Open a terminal
  2. Enter the command sudo vi /etc/hostname
  3. Edit the file, changing your existing hostname for your desired new one.
  4. Save the file

Once this is complete, your the new hostname will be reflected when the computer is rebooted.

Personal tools