-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux hostname Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to hostname on Linux, covering Arch Linux, CachyOS, and other distributions including setting hostname, viewing hostname, and system identification.
hostname shows or sets system hostname.
Uses:
- View hostname: Show current hostname
- Set hostname: Change system hostname
- System identification: Identify system
- Network identification: Identify on network
Why it matters:
- System identity: System identification
- Network: Network identification
- Services: Some services use hostname
Basic usage:
# View hostname
hostname
# Shows current hostnameFull hostname:
# Full qualified domain name
hostname -f
# -f = FQDNChange hostname:
# Set hostname
sudo hostname new-hostname
# Changes hostname (temporary)Make permanent:
# Edit hostname file
sudo vim /etc/hostname
# Or use hostnamectl
sudo hostnamectl set-hostname new-hostnameModern method:
# Set hostname permanently
sudo hostnamectl set-hostname new-hostname
# Persists across rebootsEdit file:
# Edit /etc/hostname
echo "new-hostname" | sudo tee /etc/hostname
# Also update /etc/hostsCheck installation:
# Check hostname
which hostname
# Usually in inetutils
# Install if missing
sudo pacman -S inetutilsThis guide covered hostname usage, hostname management, and system identification for Arch Linux, CachyOS, and other distributions.
- hostnamectl Guide - Modern hostname tool
- System Configuration - System setup
-
hostname Documentation:
man hostname
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.