How to Change the Computer Name Command Line

The computer name, or "hostname," is one of the ways a computer is referenced over a network. The other way is by the computer's IP address. The hostname is created when the operating system is installed. The Linux operating system allows you to change the computer's name from the command line by editing a text file. The text file that needs to be changed is the "/etc/hostname" file in the Ubuntu and Suse distributions and the "/etc/sysconfig/network" in Fedora.

Instructions

  1. Ubuntu/Suse

    • 1

      Open a terminal window which will provide you with a command line to type the following commands.

    • 2

      Type the command "sudo vi /etc/hostname" to open the "/etc/hostname" file in the vi text editor.

    • 3

      Type your password when prompted.

    • 4

      Replace the current computer name with the new computer name.

    • 5

      Type ":wq" to save the file.

    • 6

      Type the command "sudo reboot" to restart the system.

    Fedora

    • 7

      Open a terminal window which will provide you with a command line to type the following commands.

    • 8

      Type the command "su" to switch to the root user.

    • 9

      Type the command "vi /etc/sysconfig/network" to edit the file.

    • 10

      Replace the current computer name with the new computer name after "HOSTNAME=" in line two.

    • 11

      Type ":wq" to save the file.

    • 12

      Type the command "reboot" to restart the system.

    • 13

      Verify the switch by typing "hostname" at the command prompt.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured