美文网首页
CentOS7 中常用命令

CentOS7 中常用命令

作者: 与李_han | 来源:发表于2020-09-11 09:31 被阅读0次

    1、开放端口

    • 开放50070端口
    firewall-cmd --zone=public --add-port=50070/tcp --permanent
    
    • 关闭50070端口
    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
    

    相关文章

      网友评论

          本文标题:CentOS7 中常用命令

          本文链接:https://www.haomeiwen.com/subject/rudvektx.html