![]() When you open a terminal, you will find the following structure at the beginning of every Linux terminal display the current hostname in the terminal, you can use the hostname command. How to Display Current Linux Hostname with hostname command? They must contain at least 2 characters and at most 63 characters. But please make sure that a hostname must start and end with either a number or a letter. A hostname can contain digits, lowercase letters, hyphens, and dots. There are some rules when it comes to what name can you assign as a hostname to a server in the network. However, please note that you should never assign the same hostname to multiple Linux servers in the same network. At any point in time, if you wish to change the hostname for any purpose, you can easily do so in just a few steps. When you install any Linux distribution, it will ask you to enter a username and a hostname for the first time. It’s simply a name given to your Linux machine. To identify hosts or servers in a network, each Linux server is assigned a name called host-name. How to change Linux hostname for various Linux distros? As always, feel free to provide your feedback.List of content you will read in this article: ![]() I hope this article helped you to change the hostname on Linux. Therefore, one of the essential tasks for a system administrator is to know how to change the hostname. The hostname in any Linux-based distribution identifies a system uniquely in a network. Save the changes and exit from the /etc/hosts file. Then, with the editor of your choice, for example, Nano, open the file and replace all the occurrences of your old hostname with the new hostname. However, to change your hostname permanently, you’ll also need to edit your /etc/hosts file. While you changed the hostname through the hostnamectl command, you are not required to reboot the system to see the effects of the hostname change. The newly provided hostname is changed successfully on our Linux system. Therefore, you can use the hostnamectl command without any options to verify that hostname has been changed: hostnamectl Keep in mind that hostnamectl set-hostname does not produce any output. Of course, don’t forget to replace web-server with the name you’d like to use. For example, we want to change the hostname of the current system from ubuntu to web-server.įor this purpose, we will use the hostnamectl command with the set-hostname argument followed by the new hostname, in our case, web-server: sudo hostnamectl set-hostname web-server We can change the system hostname of our Linux system to any other desired hostname. Now let’s move on to changing the hostname of our Linux system. Related: What Linux Version Am I Running? Here’s How to Find Out Unlike the hostname command, hostnamectl displays a few more related details of your system, such as type of the system, operating system, kernel version, architecture, etc. You can find the system hostname in Linux by running the hostname command without any options hostnameĪs you can see from the output above, my Linux system’s hostname is ubuntu.Īnother way to get the system hostname in Linux is to run the hostnamectl command without any options: hostnamectl I will show you two of the most commonly used methods. They are several ways to check the hostname on your Linux system. Display Hostname in Linuxīefore changing the hostname, let’s first check the current hostname on our Linux system. It can be a simple string containing alphanumeric characters, dots, and hyphens. Here’s how!Ī hostname, also called a computer name, is a label assigned to a host on a network that distinguishes one device from another on a specific network. If you forget to customize the machine name during the installation of the operating system, you can do it later. Although the system sets the hostname during the installation process, you can change it at any moment in Linux.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |