Javatpoint Logo
Javatpoint Logo

Linux hostname

With the help of hostname command you can set and view hostname of the system.

Syntax:

Linux Hostname1

Look at the above snapshot, our hostname is JavaTpoint.


Setting hostname

Using hostname command you can set it on the system.

Syntax:

Example:

Linux Hostname2

Look at the above snapshot, we have set xyz.com as our hostname.

The above hostname is not permanent. Hostname set with command hostname are not permanent. On rebooting the system, hostname will change to the one that is specified in hostname file.

To set hostname permanently you have to save it in hostname file present on the server. After setting you have to reboot the box.

For Ubuntu, /etc/hostname file is used.

For RHEL, /etc/sysconfig/network is used.

Next TopicLinux curl & wget




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA