查看linux 系统版本
linux 系统版本
主要用一下命令
cat /etc/redhat-release
1.运行级别runlevel 的不同
centos6 “/etc/inittab” 在centos7中是无效的。
centos7 system target 替代 了inittab
##永久生效下次登录生效
systemctl get-default graphical.target 切换到5
systemctl get-default multi-user.target 切换到3
##临时生效的话
init3
#查看运行级别
ls -lh /usr/lib/systemd/system/runlevel*.target
运行级别对应关系
init level systemctl target
0 shutdown.target
1 emergency.target
2 rescure.target
3 multi-user.target
4 无
5 graphical.target
6 无
0 停机
1 单用户,Does not configure network interfaces, start daemons, or allow non-root logins
2 多用户,无网络连接 Does not configure network interfaces or start daemons
3 多用户,启动网络连接 Starts the system normally.
4 用户自定义
5 多用户带图形界面
6 重启
2.查看防火墙状态
centOS6
查看防火墙状态
service iptables status
关闭防火墙
service iptables stop
开启防火墙
service iptables start
centOs7
查看防火墙状态
systemctl status firewalld
关闭防火墙
systemctl stop firewalld
开启防火墙
systemctl start firewalld
3.服务存放的位置不同,
centOS6
/etc/init.d/
centOS7
/usr/lib/systemd/system
4 查看服务的命令
centOS6
chkconfig --list | grep xxx
centOS7
systemctl list-unit-files | grep xxx