centos7 命令 对比 cenots6 命令

1)  列出所有service开机启动项

centos 7 

systemctl list-unit-files |grep enabled

centos 6

 chkconfig --list|grep on

2) 切换运行级别

centos 7 

#切换去多用户命令行模式
systemctl set-default multi-user.target
#切换去图形模式
systemctl set-default graphical.target
#查看有哪些级别
systemctl list-units --type=target

centos 6

#用命令runlevel查看当前的运行级别
init 3 #切换去多用户命令行模式(无图形,服务器模式)
init 5 #切换去图形界面模式

3)设置开机启动

centos 7

systemctl disable firewalld.service #禁止开启启动
systemctl enable firewalld.service #开启开机启动

centos 6

chkconfig iptables on #设置开启启动
chkconfig iptables off #取消开机启动

4)修改主机名

centos 7

hostnamectl set-hostname www_001

centos 6

修改/etc/sysconfig/network
修改/etc/hosts
hostname newhostname //临时生效,即时生效
永久生效需要重启服务器

猜你喜欢

转载自www.cnblogs.com/faberbeta/p/centos7001.html