# Debian
# Without sudo won't show pids and process names
sudo netstat -tlpn|grep LISTEN
# macOS
# Increase +c for better names visibility
# Without sudo only shows processes of the current user
sudo lsof -i -nP +c 30|grep LISTEN
Last active
December 1, 2021 12:33
-
-
Save Aurora12/890d592a8ccfcca517512c12b6c7ffe5 to your computer and use it in GitHub Desktop.
Bash commands to show open TCP listening ports
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works on Windows as well. You'll just need to modify the
netstat
command a bit, and forgrep
, you need to have MinGW, Cygwin or Git Bash* installed. This command can also be called without administrative requirements incmd.exe
.* - When using Git Bash or Cygwin, I find it best to call
grep
in the respective terminals.