How to check the port number occupied by a process in Linux?

There are various ways to view the port numbers occupied by processes in Linux. Here are some common methods:

  1. Utilize the netstat command:
  2. show only the listening ports using the netstat command.
  3. This command will display all the listening ports and their corresponding processes.
  4. Use the lsof command:
  5. lsof -i :port number
  6. Replace the port number with the specific port number, this command will display the process information associated with that port number.
  7. Use the ss command:
  8. Show all listening sockets
  9. This command will display all the TCP ports that are being listened to, along with the corresponding processes.

These commands need to be executed using root or a user with root permissions, regardless of the method.

Leave a Reply 0

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


广告
Closing in 10 seconds
bannerAds