作为一个初学Linux的菜鸟,centos6.8和7.2的一些命令的区别,很是烦恼,因此在这和大家分享一些我掌握的一些基本命令,希望能和大家共同的学习,共同的进步。
网络重启
centos6.8
[root@localhost ~]# service network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4
state: activated
Connection activated
[ OK ]
centos7.2
[root@localhost ~]# systemctl restart network
防火墙的一些基本命令
centos6.8
查看防火墙的状态
[root@localhost ~]# service iptables status
iptables: Firewall is not running.
开启防火墙
[root@localhost ~]# service iptables start
iptables: Applying firewall rules: [ OK ]
关闭防火墙
[root@localhost ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
centos7.2
查看防火墙的状态
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2016-07-24 03:59:11 EDT; 22min ago
Main PID: 19402 (firewalld)
CGroup: /system.slice/firewalld.service
└─19402 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Hint: Some lines were ellipsized, use -l to show in full.
关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....
Jul 24 04:22:29 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewa....
Jul 24 04:22:30 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewal....
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]#
开启防火墙
[root@localhost ~]# systemctl start firewalld.service
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2016-07-24 04:24:02 EDT; 3s ago
Main PID: 21355 (firewalld)
CGroup: /system.slice/firewalld.service
└─21355 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]#