2

I want to know which port is my Jonas, on which a Java project has been deployed, is attached to in a Linux server. I have the pid of the Jonas and tried netstat -lnp but I found no port attached to that PID. Any idea of how to do this.

refresh
  • 1,319
  • 2
  • 20
  • 71

2 Answers2

2

Open a terminal application i.e. shell prompt.
Run any one of the following command:

sudo lsof -i -P -n | grep LISTEN   
sudo netstat -tulpn | grep LISTEN  
sudo nmap -sTU -O IP-address-Here  

lsof command

The syntax is:

$ sudo lsof -i -P -n  
$ sudo lsof -i -P -n | grep LISTEN  
$ doas lsof -i -P -n | grep LISTEN ### [OpenBSD] ###  
shellter
  • 36,525
  • 7
  • 83
  • 90
Jenish Patel
  • 154
  • 8
0

There are many ways to do, I prefer this

sudo netstat -pan |grep pid

Also, you can use

sudo lsof -Pan -p pid -i

pid should be actual "pid" number that you have

dlmeetei
  • 9,905
  • 3
  • 31
  • 38