CentOS7 中常用命令

2020-09-11  本文已影响0人  与李_han

1、开放端口

firewall-cmd --zone=public --add-port=50070/tcp --permanent
firewall-cmd --zone=public --remove-port=50070/tcp --permanent 
firewall-cmd --reload

2、查看防火墙所有开放的端口

firewall-cmd --zone=public --list-ports

3、关闭防火墙

systemctl stop firewalld.service

4、查看防火墙状态

firewall-cmd --state

5、禁止防火墙开机自启动

systemctl disable firewalld

6、防火墙开机自启动

systemctl enable firewalld

7、查看监听的端口

centos7默认没有 netstat 命令,需要安装 net-tools 工具,yum install -y net-tools

netstat -lnpt

8、检查端口被哪个进程占用

netstat -lnpt | grep 50070

9、查看进程的详细信息

ps [pid]

ps 2012

11、中止进程

强制杀死进程:

kill -9 [pid]

kill -9 2012

10、查看进程位置

xxx为进程pid

ls -l /proc/xxx/exe
上一篇 下一篇

猜你喜欢

热点阅读