{
    "mode": "man",
    "parameter": "hosts",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/hosts/5/json",
    "generated": "2026-10-20T15:02:09Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "hosts - static table lookup for hostnames\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "/etc/hosts",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "This  manual  page  describes  the format of the /etc/hosts file.  This file is a simple text\nfile that associates IP addresses with hostnames, one line per IP address.  For each  host  a\nsingle line should be present with the following information:\n\nIPaddress canonicalhostname [aliases...]\n\nThe  IP address can conform to either IPv4 or IPv6.  Fields of the entry are separated by any\nnumber of blanks and/or tab characters.  Text from a \"#\" character until the end of the  line\nis  a  comment,  and  is ignored.  Host names may contain only alphanumeric characters, minus\nsigns (\"-\"), and periods (\".\").  They must begin with an alphabetic character and end with an\nalphanumeric character.  Optional aliases provide  for  name  changes,  alternate  spellings,\nshorter  hostnames,  or  generic hostnames (for example, localhost).  If required, a host may\nhave two separate entries in this file; one for each version of the Internet  Protocol  (IPv4\nand IPv6).\n\nThe  Berkeley Internet Name Domain (BIND) Server implements the Internet name server for UNIX\nsystems.  It augments or replaces the /etc/hosts file or hostname lookup, and  frees  a  host\nfrom relying on /etc/hosts being up to date and complete.\n\nIn  modern systems, even though the host table has been superseded by DNS, it is still widely\nused for:\n",
            "subsections": [
                {
                    "name": "bootstrapping",
                    "content": "Most systems have a small host table containing the name and address  information  for\nimportant hosts on the local network.  This is useful when DNS is not running, for ex‐\nample during system bootup.\n\nNIS    Sites  that use NIS use the host table as input to the NIS host database.  Even though\nNIS can be used with DNS, most NIS sites still use the host table with  an  entry  for\nall local hosts as a backup.\n"
                },
                {
                    "name": "isolated nodes",
                    "content": "Very small sites that are isolated from the network use the host table instead of DNS.\nIf  the  local information rarely changes, and the network is not connected to the In‐\nternet, DNS offers little advantage.\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/hosts\n",
            "subsections": []
        },
        "NOTES": {
            "content": "Modifications to this file normally take effect immediately, except in cases where  the  file\nis cached by applications.\n",
            "subsections": [
                {
                    "name": "Historical notes",
                    "content": "RFC 952 gave the original format for the host table, though it has since changed.\n\nBefore  the  advent  of  DNS,  the  host table was the only way of resolving hostnames on the\nfledgling Internet.  Indeed, this file could be created from  the  official  host  data  base\nmaintained  at  the Network Information Control Center (NIC), though local changes were often\nrequired to bring it up to date regarding unofficial aliases and/or unknown hosts.   The  NIC\nno  longer maintains the hosts.txt files, though looking around at the time of writing (circa\n2000), there are historical hosts.txt files on the WWW.  I just found three, from 92, 94, and\n95.\n"
                }
            ]
        },
        "EXAMPLES": {
            "content": "# The following lines are desirable for IPv4 capable hosts\n127.0.0.1       localhost\n\n# 127.0.1.1 is often used for the FQDN of the machine\n127.0.1.1       thishost.example.org   thishost\n192.168.1.10    foo.example.org        foo\n192.168.1.13    bar.example.org        bar\n146.82.138.7    master.debian.org      master\n209.237.226.90  www.opensource.org\n\n# The following lines are desirable for IPv6 capable hosts\n::1             localhost ip6-localhost ip6-loopback\nff02::1         ip6-allnodes\nff02::2         ip6-allrouters\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "hostname(1), resolver(3), host.conf(5), resolv.conf(5), resolver(5), hostname(7), named(8)\n\nInternet RFC 952\n\nLinux man-pages 6.7                          2023-10-31                                     hosts(5)",
            "subsections": []
        }
    },
    "summary": "hosts - static table lookup for hostnames",
    "flags": [],
    "examples": [
        "# The following lines are desirable for IPv4 capable hosts",
        "127.0.0.1       localhost",
        "# 127.0.1.1 is often used for the FQDN of the machine",
        "127.0.1.1       thishost.example.org   thishost",
        "192.168.1.10    foo.example.org        foo",
        "192.168.1.13    bar.example.org        bar",
        "146.82.138.7    master.debian.org      master",
        "209.237.226.90  www.opensource.org",
        "# The following lines are desirable for IPv6 capable hosts",
        "::1             localhost ip6-localhost ip6-loopback",
        "ff02::1         ip6-allnodes",
        "ff02::2         ip6-allrouters"
    ],
    "see_also": [
        {
            "name": "hostname",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/hostname/1/json"
        },
        {
            "name": "resolver",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/resolver/3/json"
        },
        {
            "name": "host.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/host.conf/5/json"
        },
        {
            "name": "resolv.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/resolv.conf/5/json"
        },
        {
            "name": "resolver",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/resolver/5/json"
        },
        {
            "name": "hostname",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/hostname/7/json"
        },
        {
            "name": "named",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/named/8/json"
        }
    ]
}