Home Man
Search
Today's Posts
Register

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

How to easily identify socket given a PID on Linux?

Tags
linux

Login to Reply

 
Thread Tools Search this Thread
# 8  
Old 04-06-2017
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.
# 9  
Old 04-06-2017
Hi.
Quote:
Originally Posted by drysdalk
... 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
Login to Reply

« Previous Thread | Next Thread »
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
Packets sent from Linux TCP socket bix_20002000 IP Networking 1 01-24-2012 04:15 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
help me about sending file through socket udp with c in linux tung1984 Programming 1 08-19-2010 11:46 AM
How to Run a Linux Command and Redirect its output to a socket in C rajeshomallur Programming 3 11-15-2008 12:16 AM
how to identify the raid type on Linux? melanie_pfefer Linux 2 10-31-2008 10:52 AM
Help needed linux socket programming in c esmeco Programming 1 10-28-2008 09:55 AM
Socket Handling Differences Between Linux & Unix? Vinnie UNIX for Dummies Questions & Answers 0 07-29-2008 06:40 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 01:48 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password