Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 677 Bytes

File metadata and controls

30 lines (19 loc) · 677 Bytes

Change Hostname Of A System

Typically, hostname of a system is stored in /etc/hostname, and we can change that by writing a new hostname in /etc/hostname file.

Method 1

  1. Edit /etc/hostname with any text editor such as nano or vim, and replace the existing hostname -
sudo nano /etc/hostname
  1. Save and reboot -
sudo reboot

Method 2

Using hostnamectl command we can also set hostname, following is an example -

sudo hostnamectl set-hostname Dell-G15-5515
sudo reboot

To display current hostname, we can use hostname command.

Source: CyberCiti