Home » mariadb on ubuntu » UNIX/LINUX Command – hostname

UNIX/LINUX Command – hostname


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.)


Options Description
–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.

Related Posts

UNIX/LINUX Command – rsync

UNIX/LINUX Command – rsync

NAME rsync – a fast, versatile, remote (and local) file-copying tool rsync Command SYNOPSIS Local: rsync [OPTION…] SRC… [DEST] Access via remote shell:Pull: rsync [OPTION…] [[email protected]]HOST:SRC… [DEST]Push: rsync [OPTION…] SRC… [[email protected]]HOST:DEST Access via rsync...

UNIX/LINUX Command – strip

UNIX/LINUX Command – strip

NAME strip—Discard symbols from object files. SYNOPSIS strip [ -Fbfdname|–target=bfdname ] [ -Ibfdname|–input-target=bfdname ] [ -Obfdname|–output-target=bfdname ] [-Rsectionname|–remove-section=sectionname ] [ -s|–strip-all ] [-S|-g|–strip-debug ][-x|–discard-all...

UNIX/LINUX Command – expand

UNIX/LINUX Command – expand

NAME expand—Convert tabs to spaces SYNOPSIS expand [–tab1[,tab2[,…]]] [–t tab1[,tab2[,…]]] [–i] [—tabs=tab1[,tab2[,…]]] [–initial] [–help] [–version] [file…] DESCRIPTION This manual page documents the GNU version of expand. expand writes the contents of each given...

UNIX/LINUX Command – uuencode

UNIX/LINUX Command – uuencode

NAME uuencode—Encode a binary fileuudecode—Decode a file created by uuencode SYNOPSIS uuencode [-m] [ file ] nameuudecode [-o outfile] [ file ]… DESCRIPTION uuencode and uudecode are used to transmit binary files over transmission mediums that do not support other...

Follow Us

Our Communities

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!



Submit a Comment

Your email address will not be published.

16 − three =