zoukankan      html  css  js  c++  java
  • N天学习一个Linux命令之hostnamectl

    前言

    安装了CentOS7,发现按照以前修改文件/etc/sysconfig/network HOSTNAME字段主机名的方式不生效了,查资料发现可以使用hostnamectl命令

    用途

    Control the system hostname

    用法

    hostnamectl [options] {command}

    常用选项

    --static

    the static hostname which is used to initialize the kernel hostname at boot

    --transient

    he transient hostname which is a default received from network configuration.

    --pretty

    the high-level "pretty" hostname which might include all kinds of special characters

    实践

    显示主机名和相关信息

    [root@vm-node1 ~]# hostnamectl
       Static hostname: vm-node1
             Icon name: computer-vm
               Chassis: vm
            Machine ID: 97a20c207e324ad78ef902d44d77affd
               Boot ID: 3663cc8de26b442c9bb84c4a07f4955a
        Virtualization: oracle
      Operating System: CentOS Linux 7 (Core)
           CPE OS Name: cpe:/o:centos:centos:7
                Kernel: Linux 3.10.0-693.el7.x86_64
          Architecture: x86-64
    

      

    设置主机名

    [root@vm-node1 ~]# hostnamectl --static set-hostname vm-node1
    

      

    参考资料

    【1】man hostnamectl

  • 相关阅读:
    node爬取html乱码
    mysql字段有中英文,数字按照升序/降序 排序
    解决git反复输入密码的问题
    vue在jsx中使用for循环
    vscode插件篇
    table无法控制宽度
    console输出彩色字体
    原生js实现vue组件功能
    ES6中的proxy
    面向对象编程
  • 原文地址:https://www.cnblogs.com/wadeyu/p/7988799.html
Copyright © 2011-2022 走看看