1
.TH HOSTNAME 1 "28 Jan 1996" "net-tools" "Linux Programmer's Manual"
4
hostname \- show or set the system's host name
6
dnsdomainname \- show the system's DNS domain name
19
.RB [ \-\-ip-address ]
31
.RB [ \-\-file\ filename ]
48
is used to either set or display
49
the current host or domain name of the system. This name is used
50
by many of the networking programs to identify the machine. The domain
51
name is also used by NIS/YP.
54
When called without any arguments, the program displays the current
59
will print the name of the system as returned by the
65
will print the domain part of the FQDN (Fully Qualified Domain Name). The
66
complete FQDN of the system is returned with
67
.BR "hostname \-\-fqdn" .
70
When called with one argument or with the
72
option, the commands set the host name or the NIS/YP domain name.
75
Note, that only the super-user can change the names.
78
It is not possible to set the FQDN or the DNS domain name with the
85
The host name is usually set once at system startup in
89
(normally by reading the contents of a file which contains
94
You can't change the FQDN (as returned by
95
.BR "hostname \-\-fqdn" )
96
or the DNS domain name (as returned by
98
with this command. The FQDN of the system is the name that the
100
returns for the host name.
103
Technically: The FQDN is the name
104
.BR gethostbyname (2)
105
returns for the host name returned by
107
The DNS domain name is the part after the first dot.
109
Therefore it depends on the configuration (usually in
111
how you can change it. Usually (if the hosts file is parsed before DNS or
112
NIS) you can change it in
119
Display the alias name of the host (if used).
122
Display the name of the DNS domain. Don't use the command
124
to get the DNS domain name because it will show the NIS domain name and
125
not the DNS domain name. Use
129
.I "\-F, \-\-file filename"
130
Read the host name from the specified file. Comments (lines starting with
133
.I "\-f, \-\-fqdn, \-\-long"
134
Display the FQDN (Fully Qualified Domain Name). A FQDN consists of a
135
short host name and the DNS domain name. Unless you are using bind or NIS
136
for host lookups you can change the FQDN and the DNS domain name (which is
137
part of the FQDN) in the \fI/etc/hosts\fR file.
140
Print a usage message and exit.
142
.I "\-i, \-\-ip-address"
143
Display the IP address(es) of the host.
146
Display the short host name. This is the host name cut at the first dot.
148
.I "\-V, \-\-version"
149
Print version information on standard output and exit successfully.
151
.I "\-v, \-\-verbose"
152
Be verbose and tell what's going on.
154
.I "\-y, \-\-yp, \-\-nis"
155
Display the NIS domain name. If a parameter is given (or
157
) then root can also set a new NIS domain.
161
Peter Tobias, <tobias@et-inf.fho-emden.de>
163
Bernd Eckenfels, <net-tools@lina.inka.de> (NIS and manpage).