免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3942 | 回复: 9
打印 上一主题 下一主题

如何察看端口是什么进程打开的? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-07-21 14:02 |只看该作者 |倒序浏览
10可用积分
本机Ip是192.168.12.17

-bash-3.00$ netstat -an | grep .5080
192.168.12.17.48375  192.168.12.65.5080   66270      0 49350      0 TIME_WAIT
192.168.12.17.48444  192.168.12.65.5080   66270      0 49350    497 ESTABLISHED
192.168.12.17.48445  192.168.12.68.5080   33135      0 49350      0 ESTABLISHED

如何察看是什么进程打开的端口和远程主机192.168.12.65的5080口连接?

谢谢帮忙

最佳答案

查看完整内容

使用 #pfiles /proc/*pfiles读取/proc下的进程ID作为参数

论坛徽章:
0
2 [报告]
发表于 2008-07-21 14:02 |只看该作者
使用 #pfiles /proc/*
pfiles读取/proc下的进程ID作为参数

论坛徽章:
0
3 [报告]
发表于 2008-07-21 14:28 |只看该作者
根据你系统的版本从sunfreeware(www.sunfreeware.com)下个lsof安装包,安装后使用
/usr/local/bin/lsof -i | grep 端口号
可插到进程,从进程
ps -ef|grep 进程号
就知道了

[ 本帖最后由 todaypuzzleme 于 2008-7-21 14:37 编辑 ]

论坛徽章:
2
IT运维版块每日发帖之星
日期:2016-03-19 06:20:00数据库技术版块每日发帖之星
日期:2016-07-05 06:20:00
4 [报告]
发表于 2008-07-21 14:35 |只看该作者
1.  rpcinfo -p ---> program number
2.  cat /etc/rpc   ----> from program number find program name.

论坛徽章:
0
5 [报告]
发表于 2008-07-21 14:50 |只看该作者
刚找到个更简单的办法
#pfiles * > /tmp/pf.out
#vi pf.out
查找端口关键字,可看到关联的文件信息,包括inode num
再find文件
#find / -inum inodenum 查找文件

论坛徽章:
0
6 [报告]
发表于 2008-07-21 15:44 |只看该作者
使用lsof是一个比较通用的方法

论坛徽章:
0
7 [报告]
发表于 2008-07-21 18:29 |只看该作者
谢谢各位解答
2#因为我们系统比较重要,不让自己装软件,所以不能下载lsof
3#可是如果端口不是rpc进程打开的,在/etc/rpc里面不是找不到吗?
4#我执行pfile *的时候报下面错误,这是怎么回事呢?
bash-3.00# pfiles *
pfiles: cannot examine AllCertificates.tar: no such process
pfiles: cannot examine InstallShield: no such process
pfiles: cannot examine S99_addroute: no such process
pfiles: cannot examine S99_addroute_push: no such process
pfiles: cannot examine bin: no such process
pfiles: cannot examine cdr: no such process
pfiles: cannot examine cdrom: no such process
pfiles: cannot examine database: no such process
pfiles: cannot examine datafile: no such process
pfiles: cannot examine dev: no such process
pfiles: cannot examine devices: no such process
pfiles: cannot examine etc: no such process
pfiles: cannot examine export: no such process
pfiles: cannot examine home: no such process
pfiles: cannot examine kernel: no such process
pfiles: cannot examine lib: no such process
pfiles: cannot examine lost+found: no such process
pfiles: cannot examine mnt: no such process
pfiles: cannot examine net: no such process
pfiles: cannot examine nohup.out: no such process
pfiles: cannot examine opt: no such process
pfiles: cannot examine platform: no such process
pfiles: cannot examine proc: no such process
pfiles: cannot examine sbin: no such process
pfiles: cannot examine ssl_certs.tar: no such process
pfiles: cannot examine system: no such process
pfiles: cannot examine tmp: no such process
pfiles: cannot examine usr: no such process
pfiles: cannot examine var: no such process
pfiles: cannot examine vol: no such process
pfiles: cannot examine webapps: no such process
pfiles: cannot examine yang: no such process

论坛徽章:
0
8 [报告]
发表于 2008-07-24 11:37 |只看该作者
谢谢todaypuzzleme,你的方法很好用,哈哈

论坛徽章:
221
15-16赛季CBA联赛之吉林
日期:2017-12-11 12:51:59黑曼巴
日期:2019-04-12 13:40:0515-16赛季CBA联赛之广东
日期:2019-04-23 10:41:1215-16赛季CBA联赛之辽宁
日期:2019-05-06 13:03:2815-16赛季CBA联赛之山西
日期:2019-05-09 10:56:5815-16赛季CBA联赛之青岛
日期:2019-05-17 13:57:0515-16赛季CBA联赛之新疆
日期:2019-06-10 13:39:0515-16赛季CBA联赛之天津
日期:2019-07-08 15:04:4519周年集字徽章-19
日期:2019-08-27 13:31:2619周年集字徽章-19
日期:2019-08-27 13:31:2619周年集字徽章-周
日期:2019-09-06 18:46:4715-16赛季CBA联赛之天津
日期:2019-02-27 11:24:07
9 [报告]
发表于 2008-07-24 11:40 |只看该作者
学习

论坛徽章:
0
10 [报告]
发表于 2008-07-24 11:41 |只看该作者
怎么给分?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP