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:
- hostname command
hostname
The above command will print as username.com
- hostname -a
The above command will remove space and print as username
- To display DNS domain name
hostname -d
The above command will print as .com