hostname—Show or set the system’s hostname
dnsdomainname–Show the system’s domain name
hostname [–d][–domain][–Ffilename] [–filefilename] [–f][–fqdn][–h][–help] [–long][–s][–short][–v][–version][name]
hostname is the program that is used to either set the hostname 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.
When called without any arguments, the program displays the current name as set by the hostname command. You can change the output format to display always the short or the long hostname (FQDN). When called with arguments, the program will set the value of the hostname to the value specified. This usually is done only once, at system startup time, by the /etc/rc.d/rc.inet1 configuration script.
Note that only the superuser can change the hostname.
If the program was called as dnsdomainname, it will show the domain name server (DNS) domain name. You can’t change the DNS domain name with dnsdomainname. (See the following subsection.)
|–d, –domain||Display the name of the DNS domain. Don’t use the com-mand domainname to get the DNS domain name because it will show the NIS domain name and not the DNS domain name.|
|–F, –file filename||Read the hostname from the specified file. Comments (lines starting with a #) are ignored.|
|–f, –fqdn, –long||Display the FQDN (fully-qualified domain name). An FQDN consists of a short hostname 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 /etc/hosts file.|
|–h, –help||Print a usage message on standard output and exit successfully.|
|–s, –short||Display the short hostname.|
|–v, –version||Print version information on standard output and exit successfully.|