Last active
December 7, 2018 20:07
-
-
Save rot26/311fa4f7cd5c10f9cbb818667077461b to your computer and use it in GitHub Desktop.
[process listening on port] 3 Ways to Find Out Which Process Listening on a Particular Port https://www.tecmint.com/find-out-which-process-listening-on-a-particular-port/ #networking #port #debug #ops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Least recommended | |
# | |
# WARNING: Do not use delete flags with fuser! - Courtesy of ssolt | |
# | |
# Source: | |
# https://www.tecmint.com/find-out-which-process-listening-on-a-particular-port/ | |
# | |
# $ sudo yum install psmisc #RHEL/CentOS | |
# $ sudo apt install psmisc #Debian/Ubuntu | |
# $ sudo dnf install psmisc #Fedora 22+ | |
fuser 80/tcp | |
# Then find the process name using PID number with the ps command like so. | |
ps -p 2053 -o comm= | |
ps -p 2381 -o comm= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preferred | |
# | |
# Source: | |
# https://www.tecmint.com/find-out-which-process-listening-on-a-particular-port/ | |
# | |
# $ sudo yum install lsof #RHEL/CentOS | |
# $ sudo apt install lsof #Debian/Ubuntu | |
# $ sudo dnf install lsof #Fedora 22+ | |
lsof -i :80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preferred | |
# Most commonly available | |
# | |
# Source: | |
# https://www.tecmint.com/find-out-which-process-listening-on-a-particular-port/ | |
# | |
# $ sudo yum install net-tools #RHEL/CentOS | |
# $ sudo apt install net-tools #Debian/Ubuntu | |
# $ sudo dnf install net-tools #Fedora 22+ | |
netstat -ltnp | grep -w ':80' | |
#In the above command, the flags: | |
# l – tells netstat to only show listening sockets. | |
# t – tells it to display tcp connections. | |
# n – instructs it show numerical addresses. | |
# p – enables showing of the process ID and the process name. | |
# grep -w – shows matching of exact string (:80). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment