今天是国庆节,来点简单轻松的好了,不想思考太多了。
hostname,从字面上看应该就是类似于主机名称的意思。
sh-# hostname
my_phone
sh-# cat /proc/sys/kernel/hostname
my_phone
用户也可以根据需要使用hostname命令修改主机名称。
sh-# hostname smart_phone
sh-# hostname
smart_phone
sh-# cat /proc/sys/kernel/hostname
smart_phone
sh-# echo $HOSTNAME
intel
不过这个对于用户来讲,更改的意义不大,只要在配置文件中默认配置好即可。
系统会在开机启动时读取配置文件来设置hostname。
可是我找呀找,找呀找,怎么也没找到hostname的配置文件在哪里。
sh-# ls -l /etc/host*
-rwxr-xr-x 1 root root 26 Sep 30 09:07 /etc/host.conf
-rwxrwxrwx 1 root root 10 Sep 30 09:07 /etc/hosts
sh-# cat /etc/host.conf
order hosts,bind
multi on
sh-# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
这篇就当是入门吧,今天不想去思考整个来龙去脉了,哈哈。