LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 11-08-2007, 10:00 AM   #1
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 600

Rep: Reputation: 30
netstat and PID


On linux box I can type "netstat -anop" and it shows me PID of established connections like this:
Code:
root@proxy:~# netstat -anop
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    Timer
tcp        0      0 0.0.0.0:3128            0.0.0.0:*               LISTEN     2652/(squid)        off (0.00/0/0)
tcp6       0      0 :::10022                :::*                    LISTEN     2580/sshd           off (0.00/0/0)
tcp6       0      0 :::80                   :::*                    LISTEN     26693/httpd         off (0.00/0/0)
tcp6       0    400 ::ffff:72.185.201:10022 ::ffff:62.134.95.:45412 ESTABLISHED29203/sshd: mxer  on (0.21/0/0)
udp        0      0 0.0.0.0:32768           0.0.0.0:*                          2652/(squid)        off (0.00/0/0)
udp        0      0 0.0.0.0:32769           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32770           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32771           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32772           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32773           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32774           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32775           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32776           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32777           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:32778           0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:161             0.0.0.0:*                          26713/snmpd         off (0.00/0/0)
udp        0      0 0.0.0.0:162             0.0.0.0:*                          26714/snmptrapd     off (0.00/0/0)
udp        0      0 0.0.0.0:3130            0.0.0.0:*                          2652/(squid)        off (0.00/0/0)

Is there any way to do this similar under solaris 10 ?

Last edited by czezz; 11-08-2007 at 12:26 PM.
 
Old 11-09-2007, 06:17 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
There is no such option with Solaris netstat.

You can retrieve the ports used by a specific process with the pfiles command.

Here is a script that will display all running processes and the ports they use if any.

Code:
pfiles `ptree | awk '{print $1}'` | egrep '^[0-9]|port:'
 
Old 11-09-2007, 07:43 AM   #3
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 600

Original Poster
Rep: Reputation: 30
That's tricky - thanks.

Last edited by czezz; 11-09-2007 at 07:57 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
netstat and pid number avallach *BSD 3 06-16-2007 03:41 AM
pid in netstat command on solaris girish_hilage Linux - Networking 1 03-10-2007 02:52 AM
kill pid.... won't work with 'pid' variable given.. sachitha Programming 6 03-06-2006 08:48 PM
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 11:32 PM
ERROR: Couldn't write pid to pid file lawrencegoodman Linux - Newbie 2 02-13-2004 09:05 PM


All times are GMT -5. The time now is 09:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration