netstat -an |grep 8005
fuser -n tcp 8005
the return will be something like '8005/tcp: 9113'.
it shows pid.
ps -ef |grep 9113
In the end. I wrote a script to put all those steps together
ps_port.sh
#!/bin/sh
status=`netstat -an |grep $1`
if [ "$status" == "" ]; then
echo "port $1 is free"
exit
fi
ps -ef |grep `fuser -n tcp $1`
1 comment:
On windows, you can use the PortReporter from MicroSoft
http://www.microsoft.com/downloads/details.aspx?familyid=69BA779B-BAE9-4243-B9D6-63E62B4BCD2E&displaylang=en
Post a Comment