Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux's method to see which process the port is occupied by

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you linux to see which process the port is occupied by. I hope you will gain a lot after reading this article. Let's discuss it together.

Linux to see which process the port is occupied by: 1, use "lsof-I: Port number" to view; 2, use "netstat-tunlp | grep port number" to view.

Linux's method to see which process the port is occupied by

1. Lsof-I: Port number

2.netstat-tunlp | grep port number

You can see which process the specified port is occupied by.

[step 1] lsof-I

Lsof-I is used to display eligible processes.

Lsof (list open files) is a tool that lists files currently open by the system.

Execute the lsof-I command as the root user, as shown below

Root user executes lsof-I command

The meaning of each column of information is as follows:

Command: name of the process PID: process identifier

USER: process owner

FD: a file descriptor that the application identifies by the file description. Such as cwd,txt, etc.

TYPE: file type, such as DIR,REG, etc.

DEVICE: specify the disk name

SIZE: the size of the file

NODE: Inode (identification of files on disk)

NAME: the exact name of the open file

[step 2] lsof-I: Port number

Lsof-I: Port number, to view the occupancy of a specified port, such as the usage of port 22:

[step 3] netstat-tunlp

Netstat-tunlp is used to display the port and process of tcp,ucp, as shown below:

-t (tcp) shows only tcp related options-u (udp) shows only udp related options

-n refuses to display column names and can show that all numbers are converted to numbers

-l only shows the status of the service in listen (monitoring)

-p shows the program name of the potential-related link

[step 4] netstat-tunlp | grep port number

Netstat-tunlp | grep port number, which is used to view the process of a specified port number, such as port 22

After reading this article, I believe you have a certain understanding of the method of linux to see which process the port is occupied by. Want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report