Skip to content

Instantly share code, notes, and snippets.

@imneonizer
Created February 25, 2020 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imneonizer/9f1160e67fe9e95dbd58da53510ec2af to your computer and use it in GitHub Desktop.
Save imneonizer/9f1160e67fe9e95dbd58da53510ec2af to your computer and use it in GitHub Desktop.
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