hostnamectl
Get or set the hostname of the computer. More information: https://www.freedesktop.org/software/systemd/man/latest/hostnamectl.html.
- Get the hostname of the computer:
hostnamectl
- Set the hostname of the computer:
sudo hostnamectl set-hostname ""
- Set a pretty hostname for the computer:
sudo hostnamectl set-hostname --static "" && sudo hostnamectl set-hostname --pretty ""
- Reset hostname to its default value:
sudo hostnamectl set-hostname --pretty ""
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
