S
S
Schoolboy.2015-11-07 19:59:44
linux
Schoolboy., 2015-11-07 19:59:44

How to display only PID using netstat?

Command: netstat -tulpn | grep :25598
Output: udp 0 0 192.168.0.100:25598 0.0.0.0:* 5813/hlds_linux
As I understood 5813 is the PID of the process, how can I make it so that only the PID is output?
That is: 5813

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Softer, 2015-11-07
@viphorizon

sudo netstat -tulpn | grep:25598 | awk '{print $7}' | cut -d'/' -f1
But it's better to look in the daemon's pid file :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question