Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to the command and method of viewing hostname by linux

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the command and method of linux to check the host name, which can be used for reference by friends who need it. Next, let's take a look at the commands and methods for linux to view host names.

How does linux view hostnames?

View hostname

1. You can use the hostnamctl command.

2 、 hostnamectl .

Extended data:

Change the hostname (hostname) of the Linux system

This is achieved by modifying the configuration file.

The hostname is saved in the / etc/hostname file, so we can open the file and edit the hostname manually.

Sudo nano / etc/hosts12

Delete the old hostname, replace it with the new hostname, and save the file. Pay attention to upper and lower case.

If the / etc/hosts file is not updated, some programs, such as sudo, do not know how to resolve the new hostname.

If you are changing the hostname of the Linux server, the new hostname should resolve to the public network IP of the Linux server. If you change the hostname of the PC, the new hostname should resolve to 127.0.0.1, or 127.0.1.1.

127.0.1.1 is the IP that the Debian Linux distribution parses the local host. When the Debian system is installed, if the computer's IP is dynamic, the Debian installer creates an entry of 127.0.1.1 in the / etc/hosts file. The 127.0.1.1 address uses the loopback network card. In fact, 127.0.0.0Mab 8 (127.0.0.0 ~ 127.255.255.255) uses the loopback network card.

On the linux to view the host name commands and methods to share here, of course, not only the above and your analysis methods, but the editor can ensure its accuracy is absolutely no problem. I hope that the above content can have a certain reference value for everyone, and can be put into practice. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report