centos7 下的一些查看或者修改命令

1.临时关闭selinux
setenforce 0
2.永久关闭selinux
vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
重启生效
3.查看主机名
hostname
4.临时修改主机名
hostname xxx
5.永久修改主机名
hostnamectl set-hostname xxx
同时编辑 /etc/hostname
即可
6.查看centos的版本
cat /etc/os-release
cat /etc/redhat-release
##centos6.x使用 lsb_release -a
7.查看时区、时间
timedatectl
8.修改时区
timedatectl set-timezone Asia/Shanghai
##centos6.x使用cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
9.修改时间
timedatectl set-time "YYYY-MM-DD HH:MM:SS"
timedatectl set-time "2017-11-01 01:00:00"

猜你喜欢

转载自blog.csdn.net/xiaolong_4_2/article/details/80857325
今日推荐