hostnamectl
Get or set the hostname of the computer. More information: <https://manned.org/hostnamectl>.
Install
- All systems
-
curl cmd.cat/hostnamectl.sh
- Debian
-
apt-get install systemd - Ubuntu
-
apt-get install systemd - Arch Linux
-
pacman -S systemd - Kali Linux
-
apt-get install systemd - CentOS
-
yum install systemd - Fedora
-
dnf install systemd - Windows (WSL2)
-
sudo apt-get updatesudo apt-get install systemd - Raspbian
-
apt-get install systemd
Get or set the hostname of the computer. More information: <https://manned.org/hostnamectl>.
-
Get the hostname of the computer:
hostnamectl -
Set the hostname of the computer:
sudo hostnamectl set-hostname "hostname" -
Set a pretty hostname for the computer:
sudo hostnamectl set-hostname --static "hostname.example.com" && sudo hostnamectl set-hostname --pretty "hostname" -
Reset hostname to its default value:
sudo hostnamectl set-hostname --pretty ""
© tl;dr; authors and contributors