Port in use on Solaris 9

I want to see if port 389 is listening on Solaris.  What's the best way?
lcorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ramazanyichCommented:
run
#netstat
you will see all established and waiting connection.
check for lines with LISTENINg on it.
If something is runnning on port 389 you will see it.
0
wesly_chenCommented:
netstat -a
You need "-a" option.

Wesly
0
ramazanyichCommented:
sorry it should be
#netstat -a

or better to see only daemons:
#netstat -a | grep LISTEN

In lines check that ldap or 389 doesn't exist in first column. It means that there is no daemon listening on port 389.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TintinCommented:
Another way is to telnet to the port, eg:

telnet localhost 389
0
yuzhCommented:
netstat is the tool for the job, eg: to check the occupied port being used and the
appplication who use them, use command:

netstat –anP tcp

To find out the program listening
to a paticular tcp port

netstat -a | grep LISTEN | grep port-no

    check port 80:
    netstat -a | grep LISTEN | grep 80

man netstat
to learn more details.

and see http:Q_20887412.html

If you want to find out the process ID run on a particular port, you can use the following
script:

#!/usr/bin/ksh

echo -n "which port?> "
read port

for pid in `ps -ef -o pid | tail +2`
do
  foundport=`pfiles $pid 2>&1 | grep "sockname:" | grep "port: $port$" |
awk
'{print $NF}'`
  if [ "$foundport" != "" ]; then
    foundproc=`pfiles $pid 2>&1 | grep "^$pid:"`
    echo "$foundproc, $foundport"
  fi
done

exit

# End of script


Another good tool for the job is "lsof" you can download it from:
http://sunfreeware.com/



0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.