How to change hostname in Linux
However, don't worry, TipsMake will show you how you can change your machine's hostname in less than a minute with just a few clicks and commands.
Although this tutorial uses Ubuntu to illustrate the steps required when changing hostname, these commands should work on other Linux distributions as well.
What is hostname?
All computers connected to the network have an IP address and hostname. Hostname is the name used to identify a computer on a network in a "human readable" form. Without the hostname, when you try to locate a computer on the network, all you see is the number or IP address, like 127.0.0.1.
While IP addresses are a great way for computers to identify each other, they are not suitable for helping users identify specific computers. Let's say you want to set up a network shared folder on an Ubuntu system. If someone wants to access that folder, they'll find it much easier if they see your computer on the network showing up as 'larry-laptop' rather than '192.168.0.24'.
A common reason to switch hostnames is to avoid having the same name on the same network. For example, Ubuntu sets the hostname of all new installations to 'ubuntu' by default. If you have multiple computers on your home network and want them all to run Ubuntu Linux, you will have to change the default hostname to avoid problems.
How to change hostname through system settings
The easiest way for most people to change the hostname on a Linux machine is to go into system settings and click About. The computer's current name will appear as the first item in the list, under Device Name or similar labels on other distributions.
It's not immediately obvious, but you can click the Device Name entry and a dialog box will appear, allowing you to rename your device. Just enter whatever name you want to use in the dialog box and then click Rename.
The new hostname will be permanently set and your computer will identify itself on the network with the new name.
Change hostname using Linux Terminal
The options that appear in the system settings depend on the desktop environment you are using. The process described above should work with Ubuntu's default GNOME desktop. However, if you have switched your desktop environment or window manager, you may not have the option to change the hostname in the system settings.
If that's the case, you can change your hostname by opening a command line window and entering a simple command.
The hostnamectl command will allow you to view and change the hostname on most other Linux distributions. Just open a command line window and enter the following command to see the current hostname along with some related details:
hostnamectl
Output:
To change the hostname, enter the following command, replacing the new hostname with the name you want to use:
hostnamectl set-hostname new-hostname
To verify that the new name has been set, enter the hostname again and you should see the updated information.
Again, the command line method to change the Linux hostname should work on nearly all modern Linux distributions, not just Ubuntu.
Hope you are succesful.
You should read it
- What is UID in Linux? How to find and change the UID
- How to Get MAC Address Using Remote IP Address
- How to change Google DNS on Linux
- How to change desktop theme on Linux Mint
- How to set and change a user password in Linux
- How to Change Time Zone on Linux
- How to change the keyboard layout in Linux
- How to find, set and change IP addresses on Linux
May be interested
- Why don't developers make more apps for Linux?linux has a lot of software, but when you first switch, you may be disappointed that the operating system lacks familiar names. if you've been using linux for a while, you may also be disillusioned by certain types of software that have a relatively slow rate of change or lack of long-term support.
- 5 ways to make Linux desktops look greatvarious tools, tips and tweaks can be used to personalize linux desktops. use the following 5 methods to personalize your linux desktop environment.
- How to change DNS for Ubuntu, Linuxsuppose for some reason you need to change dns for ubuntu, such as to speed up the page loading process or access a website blocked by isp, ..., but don't know how to do it. refer to tipsmake's article below to learn more details.
- 3 main types of Linux distributions that you should knowlinux is a powerful open source kernel that powers servers and desktop operating systems. one cool feature of linux is that you can modify and change it to your liking, which has led to thousands of linux distributions coming out over the years.
- Linux Mint 20.2 'Uma' Released: What's Notable?linux mint, one of the most popular linux distributions today, has officially released version 20.2
- Amazon released Linux 2 - an attempt to change the gamelast month, amazon quietly began offering a new version of linux exclusively for its corporate customers, named linux 2.
- How to Install Linux Mint Operating Systemlinux mint is a linux operating system distribution that is becoming increasingly popular quickly, largely because of its ease of use and simplicity, neat interface, and friendliness to windows operating system users who want to change their operating systems. change the air. like most other linux distributions, because this is a free distribution, you can install it as many times as you want on as many devices as you want. over the years, the process of installing linux has become much simpler than before, even simpler than installing the windows operating system. read on to learn how to install and use linux mint.
- How is Arch Linux different from other Linux versions?arch linux is arguably the most misunderstood linux distribution. many people find arch difficult to install and maintain.
- How to change MAC addresses on Windows, Linux and MAC OS Xone of the flaws that can't catch wifi is because the network card's mac address does not match the mac address of the primary wifi network. therefore, you need to change the mac address on the computer.
- How to Change Root Password in Linuxthis tipsmake article shows how to change the root password in the linux operating system, applicable in cases where you remember your current password or cannot remember your root password.