> ## Content Index
> Fetch the complete content index at: https://www.techloy.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to change your hostname or computer name on Ubuntu Linux
- URL: https://www.techloy.com/how-to-change-your-hostname-or-computer-name-on-ubuntu-linux/
- Published: 2025-05-02T13:42:52.000Z
- Updated: 2025-05-02T13:42:52.000Z
- Description: Learn how to easily change your Ubuntu hostname via GUI or terminal.
- Author: Oyinebiladou Omemu
- Tags: / Tech Guide, Ubuntu Linux

The first time I set up my [Ubuntu Linux](https://www.techloy.com/tag/ubuntu-linux/) OS, I didn’t know they used the computer name entered as the default hostname. So, when I finally got in, you can imagine my shock working on the terminal with this long hostname “HP EliteBook x360 1030 G2” staring at me. I struggled to find my way around it, but that wasn’t till after I’d used that lengthy hostname for a while.

Now, you may not have fallen for the “Ubuntu computer name set as hostname” predicament like I did. Maybe you have a really cool hostname already, but just want to change it for whatever reason, and you’re unsure how. Fortunately, this can be easily done from the Ubuntu GUI or the terminal, whichever method you fancy. 

In this guide, we’ll show you both methods step by step, so you can pick whichever feels right for you. 

[How to install and remove software on LinuxIt can help keep your system up-to-date and running smoothly.![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/icon/techloy-avatar-1-1659.png)TechloyOyinebiladou Omemu![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/thumbnail/photo-1629654297299-c8506221ca97-3)](https://www.techloy.com/how-to-install-and-remove-software-on-linux/)

## How to change your Ubuntu Hostname using the GUI

### Step 1: Go to your App Finder and search for Settings.

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-13-1.png)

### Step 2: Scroll down and select System, then click About.

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-14-1.png)

### Step 3: You'll see the device name. Clear the input and enter the new name for your device, and hit the Enter button. Then quit the settings app. 

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-15-1.png)

## How to change your Ubuntu Hostname using the terminal

### Step 1 (Optional): Your hostname is saved in the etc directory. To confirm, run "ls /etc -la" to find the hostname. 

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-16-1.png)

### Step 2 (Optional): Now that we've confirmed we have a hostname folder, to see its information, run "hostnamectl"

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-17-1.png)

### Step 3: To change the hostname, run "hostnamectl set-hostname 'preferred-name'". To confirm the change, run the "hostnamectl" command to see your hostname details. 

NB: Your terminal will still have the old name until you refresh or close it.

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-18-1.png)

### Step 4 (Optional): Update the hostname in the hosts file. This is good because the hosts file maps IP addresses to domain names. To see the details, run "cat /etc/hosts" 

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-20-1-1.png)

- Open the hosts file with the command "sudo nano /etc/hosts." Some people open it with just "nano /etc/hosts," which is fine, but this may be an issue if you don't have write access.

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-26.png)

- You'd see that your old hostname is still mapped to your IP address.

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-21-1.png)

- Now just change the hostname and save the file, then exit.

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-23-1.png)

To confirm the change, run the "cat /etc/hosts" command again 

![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/2025/05/image-25-1.png)

[How to Change the Default Text Editor on LinuxEasily change your Linux Text Editor to your preferred editor at any time.![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/icon/techloy-avatar-1-1660.png)TechloyOyinebiladou Omemu![](https://storage.ghost.io/c/c1/a6/c1a6d111-d951-41ad-a392-c1e841210b93/content/images/thumbnail/photo-1629654297299-c8506221ca97-4)](https://www.techloy.com/how-to-change-the-default-text-editor-on-linux/)

### Conclusion

And there you have it, changing your hostname in Ubuntu doesn’t have to be a headache. Whether you went the GUI route for its simplicity or embraced the terminal for speed, you’ve now got a system name that makes sense.

Now that your machine has a proper identity, you might even find it easier to manage if you’re working with multiple systems or running servers. A clean, recognizable hostname helps avoid confusion, especially in shared environments or remote setups. 

So go ahead, enjoy your newly renamed Ubuntu system. Whether you choose something practical, playful, or just plain cool.

*Image Credit: Oyinebiladou Omemu/Techloy.com*