LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


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

Rep: Reputation: 43
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 11:26 AM.
 
Old 11-09-2007, 05:17 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,788

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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, 06:43 AM   #3
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

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

Last edited by czezz; 11-09-2007 at 06: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 02:41 AM
pid in netstat command on solaris girish_hilage Linux - Networking 1 03-10-2007 01:52 AM
kill pid.... won't work with 'pid' variable given.. sachitha Programming 6 03-06-2006 07:48 PM
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 10:32 PM
ERROR: Couldn't write pid to pid file lawrencegoodman Linux - Newbie 2 02-13-2004 08:05 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 05:21 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
Open Source Consulting | Domain Registration