在 Ubuntu 系统中,主机名的设置涉及到两个文件:
/etc/hostname: hostname 设置
/etc/hosts: hostname <=> IP 地址对应
1、查看主机名
例子:hostname email.jd.com
采用这种方式,新主机名并不保存在系统中,重启系统后主机名将恢复为原先的主机名称。
/etc/hostname中存放的是主机名
hostname文件的一个例子:email.jd.com
原文地址:http://blog.csdn.net/djd1234567/article/details/45644131