How to check the process corresponding to a port number in Linux?

To view the process associated with a port number, you can use the following command on a Linux system:

  1. Check the corresponding process of a port number using the netstat command.
netstat -tulnp | grep <端口号>

The -t option displays TCP ports, the -u option displays UDP ports, the -l option displays listening ports, the -n option displays port numbers, and the -p option displays process IDs and process names.

  1. Use the “ss” command to view the process corresponding to the port number.
ss -tulnp | grep <端口号>

The -t parameter displays TCP ports, the -u parameter displays UDP ports, the -l parameter displays listening ports, the -n parameter displays port numbers, and the -p parameter displays process IDs and process names.

  1. Use the lsof command to check the process corresponding to the port number.
lsof -i:<端口号>

This command will display all the process information that is occupying the port number.

With the above command, you can view the process information corresponding to the port number, so you can determine which process is listening on that port.

 

More tutorials

How to enable a port on a Linux operating system.(Opens in a new browser tab)

What are the steps to setting up a PostgreSQL cluster?(Opens in a new browser tab)

The Python functions ord() and chr()(Opens in a new browser tab)

A native guide to the atop command in Linux(Opens in a new browser tab)

Download and install Java for Windows 10(Opens in a new browser tab)

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds