紅帽7之hostnamectl 實用小命令用法
rhel7 很多命令和rhel6 都不一樣了,大家需要學習嘍。
先從hostnamectl 開始哈
[[email protected] ~]# hostnamectl
Static hostname: roidb02
Icon name: computer-vm
Chassis: vm
Machine ID: c3e6a26e2e00481f928f0c38b97cf5ab
Boot ID: f7d681692d96485ea81b3524c7743647
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
Kernel: Linux 3.10.0-514.el7.x86_64
Architecture: x86-64
[[email protected] ~]# hostnamectl status
Static hostname: roidb02
Icon name: computer-vm
Chassis: vm
Machine ID: c3e6a26e2e00481f928f0c38b97cf5ab
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.el7.x86_64
Architecture: x86-64
[[email protected] ~]# hostnamectl --help 幫助非常重要啊
hostnamectl [OPTIONS...] COMMAND ...
Query or change system hostname.
-h --help Show this help
--version Show package version
--no-ask-password Do not prompt for password
-H --host=[[email protected]]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--transient Only set transient hostname
--static Only set static hostname
--pretty Only set pretty hostname
Commands:
status Show current hostname settings
set-hostname NAME Set system hostname
set-icon-name NAME Set icon name for host
set-chassis NAME Set chassis type for host
set-deployment NAME Set deployment environment for host
set-location NAME Set location for host
[[email protected] ~]# cat /etc/hostname --配置文件
roidb02
[[email protected] ~]# hostnamectl set-hostname roidb01
[[email protected] ~]# cat /etc/hostname --配置文件直接生效了有沒有
roidb01
[[email protected] ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# init 6 --重啟驗證
Last login: Sun Oct 15 07:23:33 2017 from gateway
不拉不拉省略.........
..................
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# hostnamectl
Static hostname: roidb01
Icon name: computer-vm
Chassis: vm
Machine ID: c3e6a26e2e00481f928f0c38b97cf5ab
Boot ID: ec156edd01a84bdf8a4d8c91350a2ef2
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.el7.x86_64
Architecture: x86-64
[[email protected] ~]# cat /etc/hostname
roidb01
[[email protected] ~]#
小視頻網盤地址:鏈接:http://pan.baidu.com/s/1i5pa4yL 密碼:em8x
本文出自 “roidba” 博客,請務必保留此出處http://roidba.blog.51cto.com/12318731/1972450
紅帽7之hostnamectl 實用小命令用法