Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show who's using each IP port? 2

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
US
Is there a command to show what programs are listening on which ports?
'netstat -a' shows me all the ports, but I have no idea what programs they're connected to.
 
Also, [tt]netstat[/tt] has a [tt]-p[/tt] option:

Code:
   -p, --program
       Show the PID and name of the program to which each socket belongs.
 
This probably won't help in a Linux environment, but in Windows I use netstat -aon, open task manager, use view > select columns to add process ID (PID), and then match the PID for the port I'm interested in to the PID in task manager.
 
Thanks, netstat -p works great for Linux, but unfortunately it doesn't work on Solaris. :-(

Is there a corresponding command on Solaris?
 
You'll have to use lsof in Solaris:

Code:
lsof -i tcp:22

as an example...
 
The [tt]fuser[/tt] command can be used for the same thing with slightly different syntax:
Code:
fuser 22/tcp

Try the [tt]-v[/tt] option, too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top