Home > Operation and Maintenance > Linux Operation and Maintenance > The role of the host file and some commands in linux

The role of the host file and some commands in linux

零下一度
Release: 2017-07-16 11:56:17
Original
4020 people have browsed it

linux The role of the host file in

The hosts file is a file in the Linux system responsible for rapid resolution of IP addresses and domain names. It is saved in "ASCII format" /etc" directory, the file name is "hosts" (different Linux versions, this configuration file may also be different. For example, the corresponding file for Debian is /etc/hostname). The hosts file contains the mapping between IP addresses and host names, as well as aliases for the host names. In the absence of a domain name server, all network programs on the system query the file to resolve the IP address corresponding to a certain host name. Otherwise, a DNS service program needs to be used to solve the problem. Usually, commonly used domain names and IP address mappings can be added to the hosts file to achieve quick and convenient access. Host command application example in Linux

One command syntax

Function: Find the IP of a certain host name


host hostname [server]


[server]: Use a DNS server IP that is not defined by the /etc/resolv.conf file to

query the IP of a certain host.

2 Application examples

The first method is to use the DNS server defined in resolv.conf to find out the IP of the Baidu host.


The second method is to use Google’s DNS (8.8.8.8) to check the IP of Baidu host.

The above is the detailed content of The role of the host file and some commands 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