码迷,mamicode.com
首页 > 其他好文 > 详细

hostnamectl 修改 CentOS7 主机名

时间:2019-03-21 00:57:11      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:cal   ons   this   query   --   xxxx   显示   修改   rate   

hostnamectl 控制主机名

# 显示状态
hostnamectl

   Static hostname: centos
         Icon name: computer-vm
           Chassis: vm
        Machine ID: a0cacaa7df9a4b77808d5686a92f07bb
           Boot ID: bec1154b17bf4cdaa515ac528e4aab87
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-862.el7.x86_64
      Architecture: x86-64

# 查看帮助
hostnamectl -h

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=[USER@]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

 

查看主机名

cat /etc/hostname

hostname

 

修改主机名 (非临时)

vim /etc/hostname

hostnamectl set-hostname xxxx

 

hostnamectl 修改 CentOS7 主机名

标签:cal   ons   this   query   --   xxxx   显示   修改   rate   

原文地址:https://www.cnblogs.com/jhxxb/p/10569057.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!