Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

4.1.2 Configure the host name


May 23, 2021 That's what Linux should learn



In order to find a particular host in the local area network, or to distinguish between hosts, in addition to having an IP address, but also to configure a host name for the host, hosts can be accessed between each other through this name similar to the domain name. In Linux systems, the host name is mostly saved in the /etc/hostname file, and the contents of the /etc/hostname file are then modified to "linuxprobe.com", as follows.

Step 1: Use the Vim editor to modify the "/etc/hostname" host name file.

Step 2: Remove the original host name and append linuxprobe.com. Note that after you modify the host name file using the Vim editor, you can execute the wq! command in last-line mode to save and exit the document.

Step 3: Save and exit the document, and then use the hostname command to check that the modification was successful.

[root@linuxprobe ~]# vim /etc/hostname linuxprobe.com

The hostname command is used to view the current host name, but sometimes changes to the host name are not immediately synchronized to the system, so if you find that the original host name is displayed after the modification is complete, you can restart the virtual machine and then view it in rows:

[root@linuxprobe ~]# hostname linuxprobe.com