当前位置: 代码迷 >> 综合 >> Linux 进程端口查看命令:ps、netstat
  详细解决方案

Linux 进程端口查看命令:ps、netstat

热度:42   发布时间:2024-03-09 17:44:20.0

要腾服务器,古老的系统要重新部署,在linu上部署服务后,页面无法访问,然后查看服务端口是正常启动的,防火墙是放开的。。。最后发现链接输错了!!!

ps、netstat命令一直用,一直想不起来,今天再整理一下。

[root@zjweb ~]# pm2 list
┌────┬────────────────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ?    │ status   │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 1  │ snmpwalk           │ fork     │ 0    │ online   │ 0.3%     │ 44.9mb   │
│ 3  │ snmpwalk_60        │ fork     │ 0    │ online   │ 0.2%     │ 34.5mb   │
│ 0  │ webserver          │ fork     │ 0    │ online   │ 0.4%     │ 83.6mb   │
│ 2  │ webserver_60       │ fork     │ 1    │ online   │ 0.3%     │ 85.2mb   │
└────┴────────────────────┴──────────┴──────┴──────────┴──────────┴──────────┘
[root@zjweb ~]# 
[root@zjweb ~]# ps -ef | grep webserver
root      3981  3960  0 17:25 ?        00:00:52 node /home/zjgj/webserver/index.js
root      5966  3960  0 18:40 ?        00:00:36 node /home/zjgj_60_25/webserver/index.js
root     10503 10431  0 21:41 pts/0    00:00:00 grep --color=auto webserver
[root@zjweb ~]# netstat -nap | grep 3981
tcp        0      0 127.0.0.1:35878         127.0.0.1:3306          ESTABLISHED 3981/node /home/zjg 
tcp        0      0 127.0.0.1:36468         127.0.0.1:3306          ESTABLISHED 3981/node /home/zjg 
tcp6       0      0 :::3001                 :::*                    LISTEN      3981/node /home/zjg 
unix  3      [ ]         STREAM     CONNECTED     39574    3981/node /home/zjg  
unix  3      [ ]         STREAM     CONNECTED     39576    3981/node /home/zjg  
unix  3      [ ]         STREAM     CONNECTED     39578    3981/node /home/zjg  
unix  3      [ ]         STREAM     CONNECTED     39572    3981/node /home/zjg 
[root@zjweb ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:origo-native
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:hbci
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:webcache
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  10.10.0.0/16         anywhere             state NEW tcp dpt:ssh
ACCEPT     tcp  --  1.203.174.0/24       anywhere             state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:56011