DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 23rd August 2015
Peter_APIIT Peter_APIIT is offline
Shell Scout
 
Join Date: Jun 2008
Posts: 121
Default Find process associate with a Open Port

Hello to all,

As you all know, netstat -an list down all open port but how to find out the open port associate with what process? Thanks.
Reply With Quote
  #2   (View Single Post)  
Old 23rd August 2015
denta denta is offline
Shell Scout
 
Join Date: Nov 2009
Location: Sweden
Posts: 95
Default

Lets say you have a process with pid 18487 like me
Code:
18487 ??  I<      0:00.24 ntpd: ntp engine (ntpd)
You can then see all its open files, including sockets and ports with
Code:
$ fstat -p 18487
If you only have a port number and want to find the pid, you can grep an fstat command
Code:
$ fstat | grep [port number]
Reply With Quote
  #3   (View Single Post)  
Old 24th August 2015
Peter_APIIT Peter_APIIT is offline
Shell Scout
 
Join Date: Jun 2008
Posts: 121
Default

Thanks. The last command is what i looking for. Problem solved. Close thread.
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PhotoRec process bug LeFrettchen General software and network 4 1st July 2014 11:15 PM
Help please open port 8005 pf rule set whispersGhost OpenBSD Security 6 16th April 2012 11:07 PM
namp show me a 1720 open port ?? killa74 OpenBSD Security 11 11th February 2009 02:55 PM
PF wont open port despite rules... Dain_L OpenBSD Security 3 12th September 2008 01:14 AM
How to open port 80 on FreeBSD kapom FreeBSD General 14 19th June 2008 04:48 AM


All times are GMT. The time now is 05:23 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick