Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Getting correct port number from process id Post 303042848 by RudiC on Wednesday 8th of January 2020 11:22:51 AM
Old 01-08-2020
Not clear what exactly you want. How far would this get you?
Code:
netstat -anlp | awk -v"PID=$(pgrep jboss)" '$NF !~ PID {next} $(NF-1) == "LISTEN" {n=split ($4, T, "[.:]"); print T[n]} $(NF-2) == "CONNECTED" {print $(NF-1)}'
9990
8080
43013
43029

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

checking invoice number not correct

hello, I have the following script to check the invoice number is in order or not. However, it cannot show out the correct information. My expect output show below and I would like to only list out the NOT IN SEQUENCE inovice number (not included "ok") #!/bin/sh start=1 for file_number in... (8 Replies)
Discussion started by: happyv
8 Replies

2. UNIX for Dummies Questions & Answers

How to find the port number of the oracle process

Hi Unix Gurus, Can we find out the port number used by the oracle process is running.I tried to search the forum but coudnt find. Can anyone help me out with the command (2 Replies)
Discussion started by: thana
2 Replies

3. UNIX for Dummies Questions & Answers

Find what process on port number

Hi, I am on a Sun Solaris and I want to find out which process is allocated on a certain port. How can I do that? BR Andreas (4 Replies)
Discussion started by: mr_andrew
4 Replies

4. Shell Programming and Scripting

Find port number being used by a given process id

Unix gurus, I have a requirement wherein I want to find the port number for a given process id. Is it possible? If so how? TIA, Regards, Praveen (3 Replies)
Discussion started by: sunpraveen
3 Replies

5. Programming

Problem in getting the correct number from the string.

I have string named texts which consist of section label “BOOK-SEC-“. Section starts from 1 to n, where n is a number. For this example conside the value of n is 9. That is, the string variable looks like “BOOK-SEC-1... (2 Replies)
Discussion started by: SamRoj
2 Replies

6. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

7. Shell Programming and Scripting

What is the correct way to process files

Is there a general way I can use so as to process paths/files from your terminal without the need to backslash things? Till recently I used to use touch "file_here" but it does not work if file_here contains any of the characters ` and ", I still need to backslash them if I want to make the... (1 Reply)
Discussion started by: hakermania
1 Replies

8. Solaris

To get process id for port number

Hi All, How to get the list of port numbers and it is correspoding proceses id that are currently running on. Please suggest and it is urgent Thanks. (7 Replies)
Discussion started by: rbalaj16
7 Replies

9. IP Networking

Tcp ip port open but no such process (merged: Release A Port)

i want to kill a tcp connection by killing its pid with netstat -an i got the tcp ip connection on port 5914 but when i type ps -a or ps-e there is not such process running on port 5914 is it possible that because i do not log on with proper user account i can not see that process running? (30 Replies)
Discussion started by: alinamadchian
30 Replies

10. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies
procsystime(1m) 						   USER COMMANDS						   procsystime(1m)

NAME
procsystime - analyse system call times. Uses DTrace. SYNOPSIS
procsystime [-acehoT] [ -p PID | -n name | command ] DESCRIPTION
procsystime prints details on system call times for processes, both the elapsed times and on-cpu times can be printed. The elapsed times are interesting, to help identify syscalls that take some time to complete (during which the process may have slept). CPU time helps us identify syscalls that are consuming CPU cycles to run. Since this uses DTrace, only users with root privileges can run this command. OPTIONS
-a print all data -c print syscall counts -e print elapsed times, ns -o print CPU times, ns -T print totals -p PID examine this PID -n name examine processes which have this name EXAMPLES
Print elapsed times for PID 1871, # procsystime -p 1871 Print elapsed times for processes called "tar", # procsystime -n tar Print CPU times for "tar" processes, # procsystime -on tar Print syscall counts for "tar" processes, # procsystime -cn tar Print elapsed and CPU times for "tar" processes, # procsystime -eon tar print all details for "bash" processes, # procsystime -aTn bash run and print details for "df -h", # procsystime df -h FIELDS
SYSCALL System call name TIME (ns) Total time, nanoseconds COUNT Number of occurrences DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver- bose descriptions explaining the output. EXIT
procsystime will sample until Ctrl-C is hit. AUTHOR
Brendan Gregg [Sydney, Australia] SEE ALSO
dtruss(1M), dtrace(1M), truss(1) version 1.00 Sep 22, 2005 procsystime(1m)
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy