Hostname Management
View Current Hostname
# View hostname
hostnamectl
# Or traditional method
hostname
cat /etc/hostname
Change Hostname (Persistent)
# Method 1: hostnamectl (Recommended for systemd)
sudo hostnamectl set-hostname your-domain.com
# Method 2: Direct file edit (Traditional)
echo "your-domain.com" | sudo tee /etc/hostname
# Then reload systemd hostname service
sudo systemctl restart systemd-hostnamed
Verify Hostname Change
# Check hostname immediately
hostnamectl
# Check in prompt (may need to restart shell)
bash
# Verify prompt shows new hostname
# Example: root@your-domain.com:~#
Full Hostname Configuration (DNS Aligned)
If your server DNS is configured for matrix.example.com:
# Set the transient hostname (runtime)
sudo hostnamectl set-hostname matrix.example.com
# Verify
hostnamectl
Your prompt should now show:
user@matrix.example.com:~$