在Ubuntu系统中,可以通过以下几种方法来查看hostname:
hostnamectl
命令hostnamectl
Static hostname
一行,这就是你的hostname。/etc/hostname
文件cat /etc/hostname
/etc/hosts
文件cat /etc/hosts
127.0.0.1
开头的行,通常会显示为localhost <hostname>
,其中<hostname>
就是你的hostname。hostname
命令hostname
以上方法都可以帮助你查看Ubuntu系统中的hostname。选择一种你觉得最方便的方法即可。