Use the
lsof
command and grep for the port number you are interested in:
sharfah@starship:~> lsof -Pan -i tcp -i udp | grep :8343 java 27725 sharfah 6u IPv6 20486040 TCP *:8343 (LISTEN)Solaris:
If you have
lsof
installed on Solaris, then you can use the Linux method above. If you don't have or cannot install lsof
, then use the pre-installed pfiles
in a loop, as shown below:
sharfah@starship:~> ps -ef | grep myuser | awk '{print $2}' | while read pid >do >echo $pid >pfiles $pid| grep 12197 >done 19424 16132 16040 29373 15946 25178 121: S_IFREG mode:0640 dev:289,6 ino:259883 uid:50006 gid:106 size:109318 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 peername: AF_INET 10.232.160.164 port: 12197 15985 16052 18758
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.