Edit hostname on Ubuntu

Learn how to edit hostname on Ubuntu

Steps to edit hostname on Ubuntu

  1. Edit /etc/hostname

    sudo nano /etc/hostname
  2. Replace any hostname you like. Save the file.

    hello-laptop
  3. Reboot the system

    sudo reboot
  4. Check your hostname

    hostname

Written by

KarChunT

At

Fri Mar 28 2025