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

What is the specific solution for Linux system processes to occupy ports?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Linux system process occupies the port of the specific solution is, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

How does the Linux system 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 each column of information meaning is as follows: command: process name PID: process identifier USER: process owner FD: file descriptor, the application identifies the file by the file description. TYPE: file type, such as cwd,txt, DEVICE: specify disk name SIZE: file size NODE: Inode (identification of file on disk) NAME: exact name of 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

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Development

Wechat

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

12
Report