1 .\" Copyright (c) 1987, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" SPDX-License-Identifier: BSD-4-Clause-UC
6 .\" @(#)hostname.7 8.2 (Berkeley) 12/30/93
7 .\" $FreeBSD: src/share/man/man7/hostname.7,v 1.7 2004/07/03 18:29:23 ru Exp $
9 .\" 2008-06-11, mtk, Taken from FreeBSD 6.2 and modified for Linux.
11 .TH hostname 7 (date) "Linux man-pages (unreleased)"
13 hostname \- hostname resolution description
15 Hostnames are domains, where a domain is a hierarchical, dot-separated
16 list of subdomains; for example, the machine "monet", in the "example"
17 subdomain of the "com" domain would be represented as "monet.example.com".
19 Each element of the hostname must be from 1 to 63 characters long and the
20 entire hostname, including the dots, can be at most 253 characters long.
21 Valid characters for hostnames are
32 A hostname may not start with a hyphen.
34 Hostnames are often used with network client and server programs,
35 which must generally translate the name to an address for use.
36 (This task is generally performed by either
39 .BR gethostbyname (3).)
41 Hostnames are resolved by the NSS framework in glibc according
45 .BR nsswitch.conf (5).
46 The DNS-based name resolver
49 NSS service module) resolves them in the following fashion.
51 If the name consists of a single component, that is, contains no dot,
52 and if the environment variable
54 is set to the name of a file,
55 that file is searched for any string matching the input hostname.
56 The file should consist of lines made up of two white-space separated strings,
57 the first of which is the hostname alias,
58 and the second of which is the complete hostname
59 to be substituted for that alias.
60 If a case-insensitive match is found between the hostname to be resolved
61 and the first field of a line in the file, the substituted name is looked
62 up with no further processing.
64 If the input name ends with a trailing dot,
65 the trailing dot is removed,
66 and the remaining name is looked up with no further processing.
68 If the input name does not end with a trailing dot, it is looked up
69 by searching through a list of domains until a match is found.
70 The default search list includes first the local domain,
71 then its parent domains with at least 2 name components (longest first).
73 in the domain cs.example.com, the name lithium.cchem will be checked first
74 as lithium.cchem.cs.example and then as lithium.cchem.example.com.
75 lithium.cchem.com will not be tried, as there is only one component
76 remaining from the local domain.
77 The search path can be changed from the default
78 by a system-wide configuration file (see
82 .BR gethostbyname (3),
83 .BR nsswitch.conf (5),
88 .UR http://www.ietf.org\:/rfc\:/rfc1123.txt
92 .UR http://www.ietf.org\:/rfc\:/rfc1178.txt
96 .\" Hostname appeared in