×
UNIX.COM Login
Username:
Password:  
Show Password






👤


Linux

RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

How to easily identify socket given a PID on Linux?

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #8  
Old 04-06-2017
drysdalk drysdalk is offline
Registered User
 
Join Date: Feb 2017
Last Activity: 16 July 2018, 11:20 AM EDT
Location: United Kingdom
Posts: 242
Thanks: 12
Thanked 83 Times in 73 Posts
Hi,

The difficult part here would be coming up with a generic solution, since what you need from each netstat output would appear to depend on actual human knowledge of which of the listening ports is the 'correct' one. From a technical perspective, they all are: PID 32538 really is listening on ports 7666 and 38970 on all bound IPs, and on port 13804 on the IP 10.2.228.79 specifically.

So aside from you knowing which of these is the one you want, you'd need some way of identifying something that the ports you're after will actually always have in common, if you want a generic scriptable run-one-command-and-get-the-answer solution. Is there something you would always look for or which would be scriptably identifiable as the signifier of which port was the 'correct' one ? If so, then if you can give a bit more detail we may be able to narrow this down further.

As for the fd command - I've never heard of that one, sorry. Doesn't seem to either be installed or to be an option for installation on any Linux or Solaris system I currently have access to.
Sponsored Links
    #9  
Old 04-06-2017
drl's Unix or Linux Image
drl drl is offline Forum Advisor  
Registered Voter
 
Join Date: Apr 2007
Last Activity: 21 May 2018, 12:52 PM EDT
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,223
Thanks: 260
Thanked 420 Times in 361 Posts
Hi.
Quote:
Originally Posted by drysdalk View Post
... As for the fd command - I've never heard of that one, sorry. Doesn't seem to either be installed or to be an option for installation on any Linux or Solaris system I currently have access to.
Perhaps:


Code:
NAME
       fd - file & directory maintenance tool

SYNOPSIS
       fd  [ -abCefhiklmNnPrSsTtuvx ] [ -NAME=value ] [ directory [ directory2
       ...  ]]
       fdsh [ -abCcefhiklmNnPrSsTtuvx ] [ args ]

DESCRIPTION
       Fd is a file & directory maintenance tool considered for the text  ter-
       minals  on general UNIX.  It aims for a clone of the same named utility
       which is made for the PC/AT compatible machine and PC-9800 series.   In
       fact, it is upper compatible functionally.

See Debian package fdclone:


Code:
fd      file & directory maintenance tool (man)
Path    : /usr/bin/fd
Version : - ( /usr/bin/fd, 2014-08-03 )
Type    : ELF 64-bit LSB executable, x86-64, version 1 (SYSV ...)
Help    : probably available with -h

For a system like:


Code:
OS, ker|rel, machine: Linux, 3.16.0-4-amd64, x86_64
Distribution        : Debian 8.7 (jessie)

Best wishes ... cheers, drl
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Identify CPU usage on the Linux server govindts Shell Programming and Scripting 4 02-13-2012 01:14 PM
Identify failed disk in Linux RAID Loic Domaigne UNIX for Advanced & Expert Users 2 11-01-2011 04:28 PM
STILL can't buy a Linux PC easily KenJackson What is on Your Mind? 7 12-10-2010 12:32 AM
how to identify the raid type on Linux? melanie_pfefer Linux 2 10-31-2008 10:52 AM
How to identify who rebooted the linux server bache_gowda UNIX for Dummies Questions & Answers 1 05-08-2006 09:16 AM



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

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.