Skip to content

Instantly share code, notes, and snippets.

@andcam
Last active July 24, 2019 12:18
Show Gist options
  • Save andcam/f9a2777176cb287f42d63da56cfdcd7f to your computer and use it in GitHub Desktop.
Save andcam/f9a2777176cb287f42d63da56cfdcd7f to your computer and use it in GitHub Desktop.
various methods to find and list open ports
# tcp ports and services
egrep -w '(80|22|443)/tcp' /etc/services
# netstat list of open ports
sudo netstat -tulp | grep LISTEN
# -t – List all TCP ports on Linux
# -u – List all UDP ports on Linux
# -l – Show only listening sockets/ports
# -p – Show process names (PID) using sockets/ports in Linux
# -n – Do not try to resolve service names (speed up option) using /etc/resolv.conf file
sudo ss -tulpn
sudo lsof -i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment