







查看主机名
//查看一下当前主机名的情况,查看全部三种主机名
hostnamectl
//或者,查看全部三种主机名
hostnamectl status
//只查看静态、瞬态或灵活主机名,分别使用--static,--transient或--pretty选项
[root@xh00 ~]# hostnamectl --static
xh00
[root@xh00 ~]# hostnamectl --transient
xh01
[root@xh00 ~]# hostnamectl --pretty
//或者,查看到的是瞬态的(Tansient hostname)
hostname
//或者查看主机名配置文件,查看到的是静态的(Static hostname)
cat /etc/hostname
查看当前Linux操作系统相关信息(内核版本号、硬件架构、主机名称和操作系统类型等):
uname -a //查看到的是瞬态的(Tansient hostname)
cat /etc/redhat-release //查看操作系统环境
修改主机名
临时有效
hostname 主机名 //只能临时修改的主机名,当重启机器后,主机名称又变回来了。
hostname hx01
永久生效
hostnamectl set-hostname hx01
还有一个办法编辑 /etc/hostname 文件
vim /etc/hostname
重启命令
reboot init 6 shutdown -r now
关机
poweroff init 0 shoutdown -h now
安装图形
yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
init 5