28 February, 2017

How to identify if a port is listening on a unix server

We often get into a situation wherein we have to check if a particular port is being used by some process.
 
Command

netstat -an | grep [port number] | grep LISTEN

Command to identify the OS process associated with a port

lsof -i tcp:[port number]

Useful Scripts

To Find session details using SID. set verify off col sid format 99999 col machine format a10 col program format a25 trunc col username form...