linux更改电脑名称( hostname )的方法
作者:互联网
使用 hostnamectl 查看主机信息
xx@xx-server:~$ hostnamectl
Static hostname: xx-server
Icon name: computer-vm
Chassis: vm
Machine ID: xxx..
Boot ID: xxx..
Virtualization: microsoft
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.4.0-65-generic
Architecture: x86-64
更新主机名称
sudo hostnamectl set-hostname new-host-name
再次查看
xx@xx-server:~$ hostnamectl
Static hostname: new-host-name
Icon name: computer-vm
Chassis: vm
Machine ID: xxx..
Boot ID: xxx..
Virtualization: microsoft
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.4.0-65-generic
Architecture: x86-64
showtooltip
标签:xxx,..,更改,hostname,vm,xx,linux,hostnamectl 来源: https://www.cnblogs.com/coding8832/p/14408125.html