Home > Linux/Unix > Set your hostname in Linux

Set your hostname in Linux

If you are an administrator then you know what a hostname is. If you are not an administrator then you should know that the hostname of a computer is the name which a network attached device is known. Unless you have manually changed your hostname, or set it up during installation, your hostname will most likely be “localhost.localdomain”.

Find your hostname

The most common means to find your host name is to open up a terminal window and enter the command:


If you have not set your hostname, more than likely you will see returned:


Temporarily changing your hostname

You can temporarily change your hostname by issuing a single command as root user

hostname bharat

Now issue the command hostname which should report back:


This change will last until you reboot your machine.

Permanently changing your hostname

How you permanently change your hostname will depending upon which distribution you use.

On Ubuntu:

Edit the file /etc/hostname to remove old hostname and add new one.To make this chang take effect issue the command:

/etc/init.d/hostname.sh start

This hostname will remain intact upon reboot.

On Fedora/RHEL:

Edit the file /etc/sysconfig/network . The default contents of this file will look like below . Edit the hostname


Once you have made this change issue the following command (as the root user):


For the change to take effect.

Categories: Linux/Unix Tags: ,
  1. May 1, 2013 at 7:08 AM

    Very shortly this web page will be famous among all blogging and site-building visitors,
    due to it’s nice posts

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Oracle database internals by Riyaj

Discussions about Oracle performance tuning, RAC, Oracle internal & E-business suite.


Where all the Action Is !!!!

Pavan DBA's Blog

The DBA Knowledge Store

ORACLE-BASE - Latest Articles

Where all the Action Is !!!!

%d bloggers like this: