CentOS
发布时间:2022-04-02 发布网站:大佬教程 code.js-code.com
systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。
CentOS 6 service命令与CentOS 7 systemctl 命令
以httpd 为例:
任务 旧指令新指令---------------------------------------------------------------------------------------------------------------------------------------------
使某服务
自动启动
chkconfig --level 3 httpd onsystemctl enable httpd.service使某服务不
自动启动
chkconfig --level 3 httpd offsystemctl disable httpd.service检查服务状态
service httpd statussystemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅@L_489_12@是否 ActivE)@L_
489_12@所有已启动的服务
chkconfig --listsystemctl list-units --type=service启动某服务
service httpd startsystemctl start httpd.service停止某服务
service httpd stopsystemctl stop httpd.service
重启某服务 service httpd restartsystemctl restart httpd.service
2、ifconfig -> ip 命令
CentOS 7最小化系统,使用“ipaddr”和“ip link”命令来查找网卡详情。要知道统计数据,可以使用“ip -s link”
3、netstat -> ss命令
ss命令用来@L_489_12@处于活动状态的套接字信息。ss命令可以用来获取socket统计信息,它可以@L_489_12@和netstat类似的内容。但ss的优势在于它能够@L_489_12@更多更详细的有关TCP和连接状态的信息,而且比netstat更快速更高效。
4、route -> ip route命令
5、iptables-> firewall-cmd命令
Centos7的网络防火墙命令由 iptables 改成 firewall-cmd
服务启动/停止/自启/去掉自启:systemctl status/start/stop/enable/disable firewalld
centos7中默认开启防火墙,如果有新的服务需要加入端口或者关闭防火墙:
firewall-cmd--peRMANent --add-port=80/tcp
firewall-cmd--reload