{
    "mode": "man",
    "parameter": "HOSTNAME",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/HOSTNAME/7/json",
    "generated": "2026-06-15T22:57:46Z",
    "sections": {
        "NAME": {
            "content": "hostname - hostname resolution description\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Hostnames  are  domains,  where a domain is a hierarchical, dot-separated list of subdomains;\nfor example, the machine \"monet\", in the \"example\" subdomain of the  \"com\"  domain  would  be\nrepresented as \"monet.example.com\".\n\nEach  element  of  the hostname must be from 1 to 63 characters long and the entire hostname,\nincluding the dots, can be at most 253 characters long.  Valid characters for  hostnames  are\nASCII(7) letters from a to z, the digits from 0 to 9, and the hyphen (-).  A hostname may not\nstart with a hyphen.\n\nHostnames are often used with network client and server programs, which must generally trans‐\nlate  the  name  to  an  address for use.  (This task is generally performed by either getad‐‐\ndrinfo(3) or the obsolete gethostbyname(3).)\n\nHostnames are resolved by the NSS framework in glibc according to the hosts configuration  in\nnsswitch.conf.   The DNS-based name resolver (in the dns NSS service module) resolves them in\nthe following fashion.\n\nIf the name consists of a single component, that is, contains no dot, and if the  environment\nvariable  HOSTALIASES  is  set  to  the  name of a file, that file is searched for any string\nmatching the input hostname.  The file should consist of lines made  up  of  two  white-space\nseparated  strings,  the first of which is the hostname alias, and the second of which is the\ncomplete hostname to be substituted for that alias.  If a case-insensitive match is found be‐\ntween  the hostname to be resolved and the first field of a line in the file, the substituted\nname is looked up with no further processing.\n\nIf the input name ends with a trailing dot, the trailing dot is removed,  and  the  remaining\nname is looked up with no further processing.\n\nIf  the  input  name does not end with a trailing dot, it is looked up by searching through a\nlist of domains until a match is found.  The default search list includes first the local do‐\nmain,  then its parent domains with at least 2 name components (longest first).  For example,\nin  the  domain  cs.example.com,  the  name  lithium.cchem   will   be   checked   first   as\nlithium.cchem.cs.example  and  then as lithium.cchem.example.com.  lithium.cchem.com will not\nbe tried, as there is only one component remaining from the local domain.   The  search  path\ncan be changed from the default by a system-wide configuration file (see resolver(5)).\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "getaddrinfo(3), gethostbyname(3), nsswitch.conf(5), resolver(5), mailaddr(7), named(8)\n\nIETF RFC 1123 ⟨http://www.ietf.org/rfc/rfc1123.txt⟩\n\nIETF RFC 1178 ⟨http://www.ietf.org/rfc/rfc1178.txt⟩\n",
            "subsections": []
        },
        "COLOPHON": {
            "content": "This  page  is  part  of  release  5.10 of the Linux man-pages project.  A description of the\nproject, information about reporting bugs, and the latest version of this page, can be  found\nat https://www.kernel.org/doc/man-pages/.\n\n\n\nLinux                                        2019-05-09                                  HOSTNAME(7)",
            "subsections": []
        }
    },
    "summary": "hostname - hostname resolution description",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "getaddrinfo",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/getaddrinfo/3/json"
        },
        {
            "name": "gethostbyname",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/gethostbyname/3/json"
        },
        {
            "name": "nsswitch.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/nsswitch.conf/5/json"
        },
        {
            "name": "resolver",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/resolver/5/json"
        },
        {
            "name": "mailaddr",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/mailaddr/7/json"
        },
        {
            "name": "named",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/named/8/json"
        }
    ]
}