hostname MacOS Command Guide
The hostname
command in MacOS allows users to view or set the hostname of their computer system. The hostname is used to identify the device on a network, and changing it can be useful for various reasons. This guide will explain the syntax of the hostname
command, along with the available options for viewing and setting the hostname. Whether you need to troubleshoot network issues, customize your system’s identification, or simply understand more about MacOS commands, this guide will provide you with the information you need.
hostname Syntax:
Options:
Option | Description |
---|---|
-f | Display the fully qualified domain name. |
-s | Display the short hostname. |
-i | Display the network address. |
-h | Display help information. |
Parameters:
Parameter | Description |
---|---|
No parameters. This command does not require any parameters. |
hostname Command Samples:
Display the current hostname
This command shows the current hostname of the system.
Change the hostname
This command changes the hostname of the system to “NewHostName”.
Display the fully qualified domain name (FQDN)
Shows the fully qualified domain name of the system.
Display the local domain name
Displays the local domain name of the system.
Display the truncated hostname
Shows the truncated version of the hostname.
Display all information
Displays all the available information about the hostname.
Display the DNS domain name
Shows the DNS domain name of the system.
How do I display the current hostname in MacOS?
To display the current hostname in MacOS, use the following command:
How do I set a new hostname in MacOS?
To set a new hostname in MacOS, use the following command:
How do I display the fully qualified domain name (FQDN) of the system in MacOS?
To display the fully qualified domain name (FQDN) of the system in MacOS, use the following command:
How do I display the local hostname in MacOS?
To display the local hostname in MacOS, use the following command:
How do I display the network hostname in MacOS?
To display the network hostname in MacOS, use the following command:
How do I set the local hostname in MacOS?
To set the local hostname in MacOS, use the following command:
Applications of the hostname command
- Display the current hostname of the macOS system
- Set or change the hostname of the macOS system
- Display the Fully Qualified Domain Name (FQDN) of the macOS system
- Display the local domain name of the macOS system