How to modify the hosts file in linux

WBOY
Release: 2021-12-31 14:54:12
Original
42879 people have browsed it

Method: 1. Use the "vi /etc/hosts" command to open the edit text mode of hosts; 2. Enter the command "i" to enter the edit mode, and use the "sudo vi /etc/hosts" command to force the file to be changed. Permissions; 3. Enter the password to modify the file content; 4. Use the "wq" command to save the modification results.

How to modify the hosts file in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to modify the hosts file in Linux

To modify the hosts file, you need to modify the file /etc/hosts and then restart tomcat

Modify File /etc/hosts

Step 1:

Enter the command: vi /etc/hosts

Open the edit text mode of hosts

Step 2 :

Enter the command i

to enter the editing mode. At this time, you may be prompted: changing a “readonly” file attention

At this time, you can use the command to force change file permissions: sudo vi /etc/hosts

Enter the corresponding password, press Enter, enter the edit mode and modify the content to complete

Step 3:

Enter the command: :wq Save and exit

Step 4:

Enter the command: cat /etc/hosts to check whether the contents of the modified hosts file have been modified successfully

Related recommendations: "Linux Video Tutorial

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template