hostnamectl
Overview
The hostnamectl command controls the system hostname. It queries and changes system hostname and related settings.
Syntax
hostnamectl [options] [command]Common Options
| Option | Description |
|---|---|
status |
Show status |
set-hostname |
Set hostname |
set-icon-name |
Set icon name |
set-chassis |
Set chassis type |
set-deployment |
Set deployment |
set-location |
Set location |
--pretty |
Pretty hostname |
--static |
Static hostname |
--transient |
Transient hostname |
--no-ask-password |
No password |
Output Fields
| Field | Description |
|---|---|
| Hostname | System name |
| Icon Name | System icon |
| Chassis | Hardware type |
| Machine ID | System ID |
| Boot ID | Boot identifier |
| Virtualization | VM technology |
| Operating System | OS details |
| Kernel | Kernel version |
| Architecture | CPU architecture |
Key Use Cases
- System configuration
- Hostname management
- System information
- Hardware details
- OS information
Examples with Explanations
Example 1: Status
hostnamectl statusShow system status
Example 2: Set Name
hostnamectl set-hostname newnameChange hostname
Example 3: Set Pretty
hostnamectl set-hostname "Pretty Name" --prettySet pretty hostname
Common Usage Patterns
Check status:
hostnamectlChange name:
hostnamectl set-hostname nameSet chassis:
hostnamectl set-chassis server
System Information
- Host details
- System status
- Hardware info
- OS details
- Configuration
Additional Resources
Best Practices
- Proper naming
- Documentation
- Configuration
- Security
- Verification
Configuration Management
- Hostname setup
- System identity
- Network config
- DNS settings
- System details
Troubleshooting
- Name issues
- DNS problems
- Configuration errors
- System identity
- Network settings
Common Uses
- System setup
- Configuration
- Documentation
- Network setup
- Identity management