The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Security
.
google unix.com



Security Discuss UNIX and Linux computer and network security, cybersecurity, cyberattacks, IT security, CISSP, OWASP and more.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SSH Connectivity script lorcan UNIX for Advanced & Expert Users 5 03-06-2008 06:38 AM
Dos-Unix Connectivity shekhar_ssm Shell Programming and Scripting 1 01-23-2008 02:54 AM
Hummingbird Connectivity Division Releases Connectivity 2008 (EContent Magazine) iBot UNIX and Linux RSS News 0 06-17-2007 07:37 PM
Database connectivity panknil Shell Programming and Scripting 1 06-14-2007 04:35 AM
My sql connectivity comp_rupesh Shell Programming and Scripting 0 03-14-2006 02:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-24-2006
swing swing is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 3
Getting PID of Open Connectivity

Hi!

I've a Java socket server program that is listening for requests, and using netstat, I can see that the connection is already open.

However as the process name (from ps -ef) is very long and I can't grep the program name. Can anyone advise how I find out the PID of the process? Can netstat or some other command tell me that?

Thanks!


Regards
swing
  #2 (permalink)  
Old 11-24-2006
DraconianTimes's Avatar
DraconianTimes DraconianTimes is offline
Registered User
  
 

Join Date: Jul 2004
Location: United Kingdom
Posts: 23
fstat might help you here. In OpenBSD,
Code:
fstat | grep ':22' | awk '{print $3}' | uniq
This will search the fstat output for port 22, and then awk will give you the third column which is the PID for the process bound to the specified port. Replace 22 with whatever port number you are binding to (don't forget to leave in the colon symbol) and you should get the info you need. Column output and command line switches might be different! =)

Nick
  #3 (permalink)  
Old 11-24-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,235
lsof might be a better tool for what you are doing than netstat.
  #4 (permalink)  
Old 12-07-2006
swing swing is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 3
Hi! DraconianTimes & reborg

I forgot to mention that I'm on HP-UX 11i, and it doesn't seem to have fstat & lsof. Can you pls advise?

Thanks!


regards
  #5 (permalink)  
Old 12-08-2006
andryk's Avatar
andryk andryk is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2003
Posts: 448
well, take a quick tour at this
  #6 (permalink)  
Old 12-08-2006
swing swing is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 3
Hi andryk

Thanks! You've been a great help

cheers
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0