Wednesday, August 22, 2012

How to change your Ubuntu hostname from terminal ?

    When users install Ubuntu on their system they would want to change the system name/hostname whenever they feel so. Linux users are fond of terminal with which they accomplish any task they prefer which may be from copying a file to installing a software. So, in this article I would show you a way in which you can change the hostname from terminal.

Step 1:
    • Open terminal application which is available in the dash-home from your Ubuntu Unity toolbar.


Step 2:
    • Once you have opened terminal, to change the hostname we have to edit the hostname file available in /etc/hostname. This can be done with the following command,
        • sudo gedit /etc/hostname

    • Here gedit denotes your default text editor and so if you use someother text editor specify that instead of gedit.
    • Press Enter.
    • After you press enter you will be prompted to type your administrator password. Type the password and press Enter.
    • The hostname file opens in your default text editor (in this case gedit).

Step 3:
    • Now, just enter the desired hostname(in this case vms20591) you need, save the file and close the editor.

    • Restart your system.
    • To verify if you system name has been changed check your terminal.
    •  In this example, the hostname has been changed from aldo to vms20591.
     So, with the help of just one command from your terminal you can change/edit your hostname/system name whenever you need.

No comments:

Post a Comment