How To Find and Change Ubuntu, Debian, Kali Mint Hostname?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/find-and-change-ubuntu-debian-kali-mint-hostname/
PINTEREST
PINTEREST
INSTAGRAM

Hostname is used to identify the given Linux host. We generally prefer to put related hostnames to the systems like web1, db5 etc. In this tutorial we will look how to find and print hostname and change it with different methods.

Find Current Hostname

There are different ways to find hostname. But the most easy and stable way is printing related host name configuration. Host name configuration is stored in /etc/hostname which is very easy to find. We will print this configuration file like below.

Find Current Hostname
Find Current Hostname

Find Current Hostname with hostnamectl

hostnamectl is a new tool in order to manage host name configuration. We can print current hostname just providing hostnamectl  command like below. As we can more information can be found in the output like Operating system, machine UID etc.

Find Current Hostname with hostnamectl
Find Current Hostname with hostnamectl

Change Hostname Temporary

There is command named hostname which is used to change hostname temporarily. We can provide the name we want to set. But we should have root privileges for host name change.

Change Hostname Temporary
Change Hostname Temporary

Change Host name Permanently

We can change hostname permanatly too. Previous example will change hostname for current power up. After a reboot the host name will be reverted back. We will edit the hostname configuration file /etc/hostname and put whatever we want.

Change Host name with hostnamectl

hostnamectl command provides different options to list and set host name and related information. We will use set-hostname  option in order to change host name. We will set host name poftut4 like below.

LEARN MORE  How To Get Host Name and Domain Name Of Linux?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/find-and-change-ubuntu-debian-kali-mint-hostname/
PINTEREST
PINTEREST
INSTAGRAM