Home > Article > Operation and Maintenance > How to check which process is occupying port 80 in Linux
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.
#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:
If you want to see details, you can add the -v
switch, and the running results will include the process Name:
fuser -v 80/tcp
If you want to kill the process, you can use the -k
switch
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:
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!