Linux的hostname有时候有些作用,比如在shell中显示用户名@主机名

临时改变hostname

[root@localhost ~]# hostname # show current hostname
localhost.localdomain

[root@localhost ~]# hostname domain # change hostname
[root@localhost ~]# hostname
domain

永久改变hostname

[root@localhost ~]# vi /etc/hostname    # change
domain
[root@localhost ~]# exit

重新登录

[root@domain ~]# hostname
domain