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 hosts File in linux

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

Share

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

The hosts file can be modified on the Linux through the command line or through the graphical interface, which we introduce in turn, first through the command line, taking the CentOS/RHEL distribution as an example.

This version of the hosts file is in the / etc directory, and the command to open using the editor is:

Vim / etc/hosts

Once open, you can use the vim editor to add what you want, as shown in the following figure:

After the addition is completed, press: wq to save and modify the hosts file in the form of command line.

The graphical interface modifies the Hosts file, in which case you must log in as a root user, otherwise you will be prompted for your root password. After logging in, click application in the upper left corner of the page, then click favorite, and then click files to open the file manager.

Click computers on the left side of the file manager, and then all the directories in the system will be displayed on the right. Find the / etc/ directory on the right, double-click to open it, and drop down to find the hosts file.

Double-click to open the hosts file, edit the content you need directly as in notepad, and then click the save button in the upper right corner to save the content. At this point, the hosts file has been modified.

The above are the details of how to modify the linux hosts file, please pay more attention to other related articles!

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