Home  >  Article  >  Operation and Maintenance  >  How to modify the linux hosts file

How to modify the linux hosts file

(*-*)浩
(*-*)浩Original
2019-12-26 11:17:0515834browse

How to modify the linux hosts file

#On Linux, you can modify the hosts file through the command line or through the graphical interface. We will introduce it in sequence, first through the command line, taking the CentOS/RHEL distribution as an example.

The hosts file of this version is in the /etc directory. The command to open it with the editor is:

vim /etc/hosts
After opening, you can use the vim editor to add the required content, as shown below:

How to modify the linux hosts file

After the addition is completed, press :wq to save. The hosts file command line form is modified. How to modify the linux hosts file

Modify the Hosts file through the graphical interface. In this case, you must log in as the root user, otherwise you will be prompted to enter the root password when making modifications. After logging in, click application in the upper left corner of the page, then click favorite, then click files to open the file manager

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

How to modify the linux hosts file

How to modify the linux hosts file

Double-click to open the hosts file, edit the content you need directly like in Notepad, and click the save button in the upper right corner after editing. Save the content. At this point, the hosts file has been modified.

How to modify the linux hosts file

The above is the detailed content of How to modify the linux hosts file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn