zoukankan      html  css  js  c++  java
  • Linux操作命令

    1.根据进程名称查看进程号

    ps -ef|grep redis

    结果如下:

    [root@instance-xfl1djr7 ~]# ps -ef|grep redis
    root     23297     1  0 Jun12 ?        00:01:33 /usr/bin/redis-server 127.0.0.1:6378

    2.根据进行id查看占用端口号

    netstat -anp|grep 23297

    结果如下:

    [root@instance-xfl1djr7 ~]# netstat -anp|grep 23297
    tcp        0      0 127.0.0.1:6378          0.0.0.0:*               LISTEN      23297/

    3.查看防火墙开放的端口号

    iptables -L -n

    结果如下:

    [root@instance-xfl1djr7 ~]# iptables -L -n
    Chain INPUT (policy DROP)
    target     prot opt source               destination         
    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22
    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:21
    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80

    4.杀死进程

    Linux查看并杀死被占用的端口
    
    sudo apt-get install lsof   //安装lsof
    sudo lsof -i:端口号      //查找对应的进程号
    sudo kill -9 进程号      //杀死对应的进程
  • 相关阅读:
    Redis(二)
    Redis
    Nginx
    Linux的环境配置
    深入mysql
    SpringBoot入门
    Thymeleaf入门
    Mybatis之resultMap
    Mybatis入门
    使用第三方实现微信登录
  • 原文地址:https://www.cnblogs.com/xinghaonan/p/11898123.html
Copyright © 2011-2022 走看看