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

How to modify hostname by Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to modify the host name of Linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to modify the host name by Linux".

View the hostname command [root@tonyx ~] # uname-ntonyx [root@tonyx ~] # hostnametonyx through the hostname command

Command format: hostname newhostname temporarily modifies the host name. Log out and log in again with the logout command. But not permanently.

Modify via configuration file / etc/sysconfig/network

Modify this configuration file, and the linux hostname will take effect after the next restart. If you want to take effect immediately and permanently, you need to cooperate with the hostname command.

[root@tonyx ~] # cat / etc/sysconfig/networkNETWORKING=yesHOSTNAME=tonyxu file / etc/hosts function

One line of this file corresponds to a comparison, and the format of each line is: the alias of the ip global hostname hostname mainly provides a comparison between the ip and the hostname. To establish an associated "database" between the domain names of some commonly used web addresses and their corresponding IP addresses. When a user enters a URL that needs to be logged in in the browser, the system will first automatically find the corresponding IP address from the Hosts file. Once found, the system will immediately open the corresponding web page, which is equivalent to DNS parsing. For example, if the ip of baidu is 220.181.57.217, you can add a line at the end of the file:

[root@tonyx ~] # cat / etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6220.181.57.217 baidu.com here, I believe you have a better understanding of "how to modify the host name in Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report