hostnamectl 是 Linux(采用 systemd 的发行版)中的命令行工具,用于查看和设置系统主机名(hostname)以及相关的“机器信息”(如静态主机名、瞬态主机名、Pretty hostname 等)。
/ˈhoʊst.neɪm ˌsiː.tiːˈɛl/
I ran hostnamectl to check the current hostname.
我运行了 hostnamectl 来查看当前的主机名。
After migrating the server, we used hostnamectl set-hostname web-01 to update the static hostname without rebooting.
在迁移服务器后,我们使用 hostnamectl set-hostname web-01 来更新静态主机名,而无需重启。
hostnamectl 由 hostname(主机名)+ ctl(control 的常见缩写,意为“控制/管理”)构成,属于 systemd 生态中的一组 *ctl 管理命令(例如 journalctl、timedatectl),用于以统一方式管理系统信息。
hostnamectl)