Home>Article>Operation and Maintenance> How to check which process is occupying port 80 in Linux

How to check which process is occupying port 80 in Linux

青灯夜游
青灯夜游 Original
2022-07-18 18:29:40 8180browse

Two viewing methods: 1. Use the fuser command to directly check which process the specified port is occupied on Linux. The syntax is "fuser -v 80/tcp", and the running result will include the name of the process. and id. 2. Use the lsof command to find the corresponding process information based on the specified port. The syntax is "lsof -i:80". You can view the process information occupying port 80 in the output result.

How to check which process is occupying port 80 in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

There are two ways to check which process a port is occupied in Linux.

Use the fuser command

Use the fuser command to directly check which process the port is occupied on Linux

fuser 80/tcp

Above Use the command to check which process is occupying port 80. You may see results similar to the following:

How to check which process is occupying port 80 in Linux

If you want to see details, you can add the-vswitch, and the running results will include the process Name:

fuser -v 80/tcp

How to check which process is occupying port 80 in Linux

If you want to kill the process, you can use the-kswitch

fuser -k 80/tcp

Use lsof

lsof command, the abbreviation of "list opened files", literally translated, is to list the files that have been opened in the system. Through the lsof command, we can find the corresponding process information based on the file, and we can also find the file opened by the process based on the process information.

Use the lsof command to find the corresponding process information based on the specified port.

Enter the following command:

lsof -i:80

The running result is similar to the screenshot below:

How to check which process is occupying port 80 in Linux

Related recommendations: "Linux Video Tutorial

The above is the detailed content of How to check which process is occupying port 80 in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn