Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
how to rename hostname on linux

How to change linux hostname

Reference: ubuntu-change-hostname-command

  1. modify the /etc/hostname file and change the hostname to as per your choice.

    sudo vim /etc/hostname
    
  2. modify /etc/hosts file and change the hostname to as per your choice.

    sudo vim /etc/hosts
    
  3. using hostnamectl command again change the hostname

sudo hostnamectl set-hostname nitin-pc01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment