Chinaunix

标题: linux主机名与域名设置 [打印本页]

作者: china_shentong    时间: 2010-01-21 00:50
标题: linux主机名与域名设置
安装rhel5,终端显示
[root@localhost ~]#
cat /etc/sysconfig/network中,HOSTNAME=localhost.localdomain
然后,我编辑了/etc/sysconfig/network为
HOSTNAME=linux-dns.example.com
终端显示
[root@linux-dns  ~]#

我的疑问,为什么不显示[root@linux-dns.example ~]#
还有,/etc/sysconfig/network中定义的是主机名,还是域名?两者大家都什么样的理解?

我是新手,大家理解多少,就顶多少吧,谢谢!
作者: foxyzhou    时间: 2010-01-21 16:39
/etc/sysconfig/network 中的 HOSTNAME 为主机名不是域名
PS1='[\u@\H \w]';export PS1 就可以显示完整的主机名了
作者: yumanifold    时间: 2010-01-21 18:17
定义的是主机名,同时由你的变量PS1定义。。。你可以通过定义PS1来改变此默认模式

[root@manifold ~]# cat /etc/bashrc |grep -i ps1
if [ "$PS1" ]; then
    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

[ 本帖最后由 yumanifold 于 2010-1-21 18:18 编辑 ]




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2