Get the App
SLTechnology News&Howtos  ›  Servers  › 

How linux modifies hosts files

Shulou Source: shulou.com Published: 2022-05-31 15:09:53 10月05日 Update

This article mainly explains "linux how to modify hosts file", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "linux how to modify hosts file" bar!

Methods: 1, use the "vi / etc/hosts" command to open the editing text mode of hosts; 2, enter the command "I" to enter the editing mode, and use the "sudo vi / etc/hosts" command to force change the file permissions; 3, enter the password to modify the file content; 4, use the "wq" command to save the modification results.

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

How to modify hosts files by linux

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

Modify the file / etc/hosts

Step one:

Enter command: vi / etc/hosts

Turn on the edit text mode of hosts

Step 2:

Enter command I

When you enter edit mode, you may be prompted: changing a "readonly" file attention

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

Enter the corresponding password, enter, enter the edit mode and modify the content.

Step 3:

Enter the command:: wq to save and exit

Step 4:

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

Thank you for reading, the above is the content of "linux how to modify the hosts file", after the study of this article, I believe you have a deeper understanding of how linux modifies the hosts file, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Files commands input content patterns learning passwords text permissions coercion success that is ideas situations sense of success tutorials articles methods more environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info vpn Redmi MySQL Huawei