Linux Commands Helper
💬 Your AI-powered Linux assistant
hostnamectl Command - Control the System Hostname
The hostnamectl command is used to query and change the system hostname and related settings on systems that use systemd
.
Syntax
hostnamectl [options] [command]
Examples
hostnamectl
Show current hostname and related information.
hostnamectl set-hostname newname
Set the system hostname to 'newname'.
hostnamectl status
Display detailed status information about the system's hostname.
Notes
- hostnamectl is part of the systemd suite and works only on systems using systemd.
- Changes made with hostnamectl are persistent across reboots.
- Use
hostname
for legacy systems or temporary changes.