1、主机名配置文件
[[email protected] ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=brj
2、查看主机名
[[email protected] ~]# hostname
brj
3、临时修改主机名
[[email protected] ~]# hostname oldboy36
4、永久修改主机名
[[email protected] ~]# sed ‘s#HOSTNAME=.*#HOSTNAME=oldboy36#‘ /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=oldboy36
[[email protected] ~]# sed ‘s#HOSTNAME=.*#HOSTNAME=oldboy36#‘ /etc/sysconfig/network -i
[[email protected] ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=oldboy36
练习题:
详细说明如何设置linux主机名(临时和永久)
原文地址:https://www.cnblogs.com/Klanti/p/9143200.html
时间: 2024-11-05 20:27:54