Random Musings

Sporadic thoughts on tech, economics, business, finance and trading

Fedora / Manjaro – Change Hostname – Var 1

,

Using hostnamectl to Change the Hostname

  1. Open a Terminal: Launch a terminal in your Manjaro system.

  2. Change the Hostname: Use the hostnamectl command to set the new hostname:

    sudo hostnamectl set-hostname new-hostname
    

    Replace new-hostname with the desired hostname.

  3. Verify the Change: To confirm the new hostname has been set, run:

    hostnamectl
    

    This will display the current hostname along with other system information.

  4. Edit /etc/hosts (Optional but Recommended):

    • You should still update the /etc/hosts file to ensure proper hostname resolution. Open the file with:
      sudo nano /etc/hosts
      
    • Update the line containing the old hostname to the new one:
      127.0.1.1   new-hostname
      
    • Save and exit.
  5. Reboot the System (Optional): While the hostname change takes effect immediately for many operations, a reboot ensures all services recognize the new hostname:

    sudo reboot
    

This method is straightforward and effectively changes the hostname system-wide.