Knowledgebase
Locating the port a process or application is running on can be a tricky task at times especially, if the application files, configuration, or setup can't be located. This can be useful if you need to end/stop a service running on a specific port. To do this follow the below instructions set in this guide.
The usage of the lsof command per the below example is a great way to see what is running or using a specific port.
lsof -i tcp:3000This command will return a list of processes running on this port on the system. The output may look like the below.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Node ru 1124 root 28u IPv6 19573 0t0 TCP *:3000 (LISTEN)If you're looking to stop the process running on the port, the kill command can be utilised to perform such actions. For example to kill the process listed above on port 3000 the below command could be ran by using the PID.
kill 1124