N天学习一个Linux命令之hostnamectl
2024-10-01 00:59:13
前言
安装了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
最新文章
- C++ 非阻塞套接字的使用 (3)
- Visual Studio无法查找或打开 PDB 文件解决办法
- 基本linux命令
- 【URAL】1960. Palindromes and Super Abilities
- noi 2989 糖果
- css3制作惊艳hover切换效果
- 用SQL语句修复SQL Server数据库
- Codeforces Round #313 (Div. 2)B.B. Gerald is into Art
- 如何在RedHat6(7) or CentOS6(7)上制作无依赖的PostgreSQL数据库的RPM包
- Qt 类外调用一个 private slots 函数
- 设置navigationBar上面的item
- 【BZOJ 1188】 [HNOI2007]分裂游戏
- iOS Mac系统下Ruby环境安装
- 《A First Course in Abstract Algebra with Applications》-chaper1-数论
- JavaScript DOM编程艺术-学习笔记(第五章、第六章)
- springboot整合微软的ad域,采用ldap的api来整合,实现用户登录验证、
- jenkins构建任务后发送邮件
- Django中间件基础笔记
- 设计模式之UML类图六大关系辨析【2】
- Django商城项目笔记No.15用户部分-用户中心邮箱验证