hostname Linux Commands

What is Linux hostname Command?

Explanation

hostname COMMAND:

hostname specifies the name of the host.

SYNTAX :


hostname [-a | -d | -f | -h | -i | -s]

OPTIONS:


-a Displays the alias name of the host, if used.
-d Displays DNS domain name
-f Displays fully qualified domain name.
-h Displays help message.
-i Displays IP address of the host.
-s Trim domain name from display.

EXAMPLE:


  1. hostname command
    hostname

    The above command will print as username.com
  2. hostname -a
    The above command will remove space and print as username
  3. To display DNS domain name
    hostname -d
    The above command will print as .com

Ask Questions

Ask Question