Linux常用命令

centos7修改hostname

hostnamectl set-hostname centos102  # 使用这个命令会立即生效且重启也生效
vi /etc/hosts                       # 编辑下hosts文件, 给127.0.0.1添加hostname
cat /etc/hosts                      # 检查hosts
127.0.0.1   localhost centos102
::1         localhost centos102
原文地址:https://www.cnblogs.com/shih945/p/13124746.html