hostname
Overview
The hostname
command shows or sets the system’s host name. It displays the name by which the system is known on a network.
Syntax
hostname [options] [hostname]
Common Options
Option | Description |
---|---|
-a |
Alias names |
-A |
All FQDNs |
-d |
DNS domain |
-f |
FQDN name |
-i |
IP addresses |
-I |
All addresses |
-s |
Short name |
-y |
NIS domain |
--help |
Show help |
--version |
Show version |
Output Types
Type | Description |
---|---|
Short | Simple hostname |
FQDN | Full domain name |
Domain | DNS domain |
IP | IP addresses |
Alias | Alternative names |
Key Use Cases
- System identification
- Network configuration
- DNS setup
- Host verification
- Network troubleshooting
Examples with Explanations
Example 1: Show Name
hostname
Display hostname
Example 2: Show FQDN
hostname -f
Full domain name
Example 3: Show IPs
hostname -I
All IP addresses
Common Usage Patterns
Basic check:
hostname
Network info:
hostname -i
Domain name:
hostname -d
Network Information
- Host name
- Domain name
- IP addresses
- Alias names
- Network identity
Additional Resources
Best Practices
- Proper naming
- DNS alignment
- Network consistency
- Documentation
- Regular verification
Network Analysis
- Name resolution
- IP configuration
- Domain setup
- Network identity
- System naming
Troubleshooting
- Name resolution
- DNS issues
- Network problems
- Configuration errors
- Identity conflicts
Common Uses
- System setup
- Network config
- DNS management
- Identity verification
- Documentation