免费注册 查看新帖 |

Chinaunix

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

求教solaris如何查看当前某个端口是哪个进程在监听? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-26 11:20 |只看该作者 |倒序浏览
貌似用netstat看不到

论坛徽章:
0
2 [报告]
发表于 2008-08-26 11:31 |只看该作者
netstat -a | grep LISTEN

论坛徽章:
2
双鱼座
日期:2014-02-23 12:10:03操作系统版块每日发帖之星
日期:2015-12-17 06:20:00
3 [报告]
发表于 2008-08-26 11:34 |只看该作者
# netstat -a | grep LISTEN\r\n      *.sunrpc             *.*                0      0 24576      0 LISTEN\r\n      *.32771              *.*                0      0 24576      0 LISTEN\r\n      *.ftp                *.*                0      0 24576      0 LISTEN\r\n      *.telnet             *.*                0      0 24576      0 LISTEN\r\n      *.shell              *.*                0      0 24576      0 LISTEN\r\n      *.shell              *.*                0      0 24576      0 LISTEN\r\n      *.login              *.*                0      0 24576      0 LISTEN\r\n      *.exec               *.*                0      0 24576      0 LISTEN\r\n      *.exec               *.*                0      0 24576      0 LISTEN\r\n      *.uucp               *.*                0      0 24576      0 LISTEN\r\n      *.finger             *.*                0      0 24576      0 LISTEN\r\n      *.time               *.*                0      0 24576      0 LISTEN\r\n      *.echo               *.*                0      0 24576      0 LISTEN\r\n      *.discard            *.*                0      0 24576      0 LISTEN\r\n      *.daytime            *.*                0      0 24576      0 LISTEN\r\n      *.chargen            *.*                0      0 24576      0 LISTEN\r\n      *.swat               *.*                0      0 24576      0 LISTEN\r\n      *.32772              *.*                0      0 24576      0 LISTEN\r\n      *.32773              *.*                0      0 24576      0 LISTEN\r\n      *.32774              *.*                0      0 24576      0 LISTEN\r\n      *.fs                 *.*                0      0 24576      0 LISTEN\r\n      *.printer            *.*                0      0 24576      0 LISTEN\r\n      *.dtspc              *.*                0      0 24576      0 LISTEN\r\n      *.sun-dr             *.*                0      0 24576      0 LISTEN\r\n      *.sun-dr             *.*                0      0 24576      0 LISTEN\r\n      *.32775              *.*                0      0 24576      0 LISTEN\r\n      *.lockd              *.*                0      0 24576      0 LISTEN\r\n      *.5987               *.*                0      0 24576      0 LISTEN\r\n      *.898                *.*                0      0 24576      0 LISTEN\r\n      *.32784              *.*                0      0 24576      0 LISTEN\r\n      *.9010               *.*                0      0 24576      0 LISTEN\r\n      *.32803              *.*                0      0 24576      0 LISTEN\r\n      *.2410               *.*                0      0 24576      0 LISTEN\r\n      *.32810              *.*                0      0 24576      0 LISTEN\r\n      *.445                *.*                0      0  8576      0 LISTEN\r\n      *.netbios-ssn        *.*                0      0  8576      0 LISTEN\r\n      *.32853              *.*                0      0 24576      0 LISTEN\r\n      *.32854              *.*                0      0 24576      0 LISTEN\r\nlocalhost.32871            *.*                0      0 24576      0 LISTEN\r\nlocalhost.32874            *.*                0      0 24576      0 LISTEN\r\n      *.smtp               *.*                0      0 24576      0 LISTEN\r\n      *.smtp               *.*                0      0 24576      0 LISTEN\r\n      *.submission         *.*                0      0 24576      0 LISTEN\r\n      *.ftp                             *.*                             0      0 24576      0 LISTEN           \r\n      *.telnet                          *.*                             0      0 24576      0 LISTEN           \r\n      *.shell                           *.*                             0      0 24576      0 LISTEN           \r\n      *.login                           *.*                             0      0 24576      0 LISTEN           \r\n      *.exec                            *.*                             0      0 24576      0 LISTEN           \r\n      *.finger                          *.*                             0      0 24576      0 LISTEN           \r\n      *.time                            *.*                             0      0 24576      0 LISTEN           \r\n      *.echo                            *.*                             0      0 24576      0 LISTEN           \r\n      *.discard                         *.*                             0      0 24576      0 LISTEN           \r\n      *.daytime                         *.*                             0      0 24576      0 LISTEN           \r\n      *.chargen                         *.*                             0      0 24576      0 LISTEN           \r\n      *.printer                         *.*                             0      0 24576      0 LISTEN           \r\n      *.sun-dr                          *.*                             0      0 24576      0 LISTEN           \r\n      *.smtp                            *.*                             0      0 24576      0 LISTEN

论坛徽章:
0
4 [报告]
发表于 2008-08-26 11:45 |只看该作者
谢谢楼上的几位!\r\n我用openldap在5001端口监听\r\n这样输出的是\r\nlocalhost.5001           *.*                0      0 49152      0 LISTEN\r\n还是没有进程的名字。。。

论坛徽章:
0
5 [报告]
发表于 2008-08-26 13:22 |只看该作者
lsof确实是个好东东啊

论坛徽章:
0
6 [报告]
发表于 2008-08-26 14:15 |只看该作者
找找前几天的帖子,有!

论坛徽章:
0
7 [报告]
发表于 2008-08-26 15:38 |只看该作者
below script will do the same thing as part of lsof, though I highly recommend lsof.\r\n\r\n#!/bin/ksh\r\n#\r\n# 7-30-2003\r\n# find from a port the pid that started the port\r\n#\r\nline=\'-------------------------------------------------------------------------\'\r\npids=`/usr/bin/ps -ef | sed 1d | awk \'{print $2}\'`\r\n\r\n# Prompt users or use 1st cmdline argument\r\nif [ $# -eq 0 ]; then\r\n         read ans?\"Enter port you like to know pid for:  \"\r\nelse\r\n         ans=$1\r\nfi\r\n\r\n# Check all pids for this port, then list that process\r\nfor f in $pids\r\ndo\r\n         /usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q \"port: $ans\"\r\n         if [ $? -eq 0 ] ; then\r\n                 echo \"$line\\nPort: $ans is being used by PID: \\c\"\r\n                 /usr/bin/ps -o pid -o args -p $f | sed 1d\r\n         fi\r\ndone\r\nexit 0\n\n[ 本帖最后由 shyjack 于 2008-8-26 15:39 编辑 ]

论坛徽章:
0
8 [报告]
发表于 2008-08-26 19:15 |只看该作者
嗨 蜘蛛前阵子去哪里了。人影不见
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP