Home Explore Blog CI



man-pages

3rd chunk of `hostname.man`
da6288c53e8e8b89b010220cb7100dac1443b5ea6c798d710000000100000e1a
 the same name, therefore the  output  may  contain
              duplicate entries. Do not make any assumptions about the order of
              the output.

       -b, --boot
              Always set a hostname; this allows the file specified by -F to be
              non‐existent  or empty, in which case the default hostname local‐
              host will be used if none is yet set.

       -d, --domain
              Display the name of the DNS domain.  Don’t use  the  command  do‐
              mainname  to get the DNS domain name because it will show the NIS
              domain name and not the DNS domain name.  Use  dnsdomainname  in‐
              stead.  See the warnings in section THE FQDN above, and avoid us‐
              ing this option.

       -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 us‐
              ing 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. See the warnings in section THE FQDN above und use hostname
              --all‐fqdns instead wherever possible.

       -F, --file filename
              Read the host name  from  the  specified  file.  Comments  (lines
              starting with a ‘#’) are ignored.

       -i, --ip‐address
              Display  the network address(es) of the host name. Note that this
              works only if the host name can be resolved. Avoid using this op‐
              tion; use hostname --all‐ip‐addresses instead.

       -I, --all‐ip‐addresses
              Display all network addresses of the host. This option enumerates
              all configured addresses on all network interfaces. The  loopback
              interface  and IPv6 link‐local addresses are omitted. Contrary to
              option -i, this option does not depend on name resolution. Do not
              make any assumptions about the order of the output.

       -s, --short
              Display the short host name. This is the host  name  cut  at  the
              first dot.

       -V, --version
              Print  version  information  on standard output and exit success‐
              fully.

       -y, --yp, --nis
              Display the NIS domain name. If a parameter is given  (or  --file
              name ) then root can also set a new NIS domain.

       -h, --help
              Print a usage message and exit.

NOTES
       The  address  families  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 inet6 option in
       /etc/resolv.conf.

FILES
       /etc/hostname Historically this file was supposed to  only  contain  the
       hostname and not the full canonical FQDN. Nowadays most software is able
       to  cope  with  a  full FQDN here. This file is read at boot time by the
       system initialization scripts to set the hostname.

       /etc/hosts Usually, this is where one sets the domain name  by  aliasing
       the host name to the FQDN.

AUTHORS
       Peter Tobias, <tobias@et‐inf.fho‐emden.de>
       Bernd Eckenfels, <net‐tools@lina.inka.de> (NIS and manpage).
       Michael Meskes, <meskes@debian.org>

net‐tools                          2009‐09‐16                       HOSTNAME(1)

Title: Hostname Command Options, Notes, and Files
Summary
This section details various options for the `hostname` command, including: `-F/--file`, `-i/--ip-address`, `-I/--all-ip-addresses`, `-s/--short`, `-V/--version`, `-y/--yp/--nis`, and `-h/--help`. It also provides notes on how the resolver configuration affects the address families used for lookups. Additionally, it describes the purpose of `/etc/hostname` and `/etc/hosts` files, highlighting their roles in setting the hostname and domain name.