1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
.TH HOSTNAME 1 "28 Jan 1996" "net-tools" "Linux Programmer's Manual"
.SH NAME
hostname \- show or set the system's host name
.br
dnsdomainname \- show the system's DNS domain name
.br
.SH SYNOPSIS
.B hostname
.RB [ \-v ]
.RB [ \-a ]
.RB [ \-\-alias ]
.RB [ \-d ]
.RB [ \-\-domain ]
.RB [ \-f ]
.RB [ \-\-fqdn ]
.RB [ \-i ]
.RB [ \-\-ip-address ]
.RB [ \-\-long ]
.RB [ \-s ]
.RB [ \-\-short ]
.RB [ \-y ]
.RB [ \-\-yp ]
.RB [ \-\-nis ]
.PP
.B hostname
.RB [ \-v ]
.RB [ \-F\ filename ]
.RB [ \-\-file\ filename ]
.RB [ hostname ]
.PP
.B hostname
.RB [ \-v ]
.RB [ \-h ]
.RB [ \-\-help ]
.RB [ \-V ]
.RB [ \-\-version ]
.PP
.B dnsdomainname
.RB [ \-v ]
.SH DESCRIPTION
.B Hostname
is used to either set or display
the current host or domain name of the system. This name is used
by many of the networking programs to identify the machine. The domain
name is also used by NIS/YP.
.SS "GET NAME"
When called without any arguments, the program displays the current
names:
.LP
.B hostname
will print the name of the system as returned by the
.BR gethostname (2)
function.
.LP
.B dnsdomainname
will print the domain part of the FQDN (Fully Qualified Domain Name). The
complete FQDN of the system is returned with
.BR "hostname \-\-fqdn" .
.SS "SET NAME"
When called with one argument or with the
.B \-\-file
option, the commands set the host name or the NIS/YP domain name.
.LP
Note, that only the super-user can change the names.
.LP
It is not possible to set the FQDN or the DNS domain name with the
.B dnsdomainname
command (see
.B "THE FQDN"
below).
.LP
The host name is usually set once at system startup in
.I /etc/rc.d/rc.inet1
or
.I /etc/init.d/boot
(normally by reading the contents of a file which contains
the host name, e.g.
.IR /etc/hostname ).
.SS THE FQDN
You can't change the FQDN (as returned by
.BR "hostname \-\-fqdn" )
or the DNS domain name (as returned by
.BR "dnsdomainname" )
with this command. The FQDN of the system is the name that the
.BR resolver (3)
returns for the host name.
.LP
Technically: The FQDN is the name
.BR gethostbyname (2)
returns for the host name returned by
.BR gethostname (2).
The DNS domain name is the part after the first dot.
.LP
Therefore it depends on the configuration (usually in
.IR /etc/host.conf )
how you can change it. Usually (if the hosts file is parsed before DNS or
NIS) you can change it in
.IR /etc/hosts .
.SH OPTIONS
.TP
.I "\-a, \-\-alias"
Display the alias name of the host (if used).
.TP
.I "\-d, \-\-domain"
Display the name of the DNS domain. Don't use the command
.B domainname
to get the DNS domain name because it will show the NIS domain name and
not the DNS domain name. Use
.B dnsdomainname
instead.
.TP
.I "\-F, \-\-file filename"
Read the host name from the specified file. Comments (lines starting with
a `#') are ignored.
.TP
.I "\-f, \-\-fqdn, \-\-long"
Display the FQDN (Fully Qualified Domain Name). A FQDN consists of a
short host name and the DNS domain name. Unless you are using bind or NIS
for host lookups you can change the FQDN and the DNS domain name (which is
part of the FQDN) in the \fI/etc/hosts\fR file.
.TP
.I "\-h, \-\-help"
Print a usage message and exit.
.TP
.I "\-i, \-\-ip-address"
Display the network address(es) of the host.
.TP
.I "\-s, \-\-short"
Display the short host name. This is the host name cut at the first dot.
.TP
.I "\-V, \-\-version"
Print version information on standard output and exit successfully.
.TP
.I "\-v, \-\-verbose"
Be verbose and tell what's going on.
.TP
.I "\-y, \-\-yp, \-\-nis"
Display the NIS domain name. If a parameter is given (or
.B \-\-file name
) then root can also set a new NIS domain.
.SH NOTES
The address families
.B hostname
tries when looking up the FQDN, aliases and network addresses of the
host are determined by the configuration of your resolver.
For instance, on GNU Libc systems, the resolver can be instructed to
try IPv6 lookups first by using the
.B inet6
option in
.BR /etc/resolv.conf .
.SH FILES
.B /etc/hosts
.SH AUTHORS
Peter Tobias, <tobias@et-inf.fho-emden.de>
.br
Bernd Eckenfels, <net-tools@lina.inka.de> (NIS and manpage).
.br
|