Skip to content

Instantly share code, notes, and snippets.

@sar
Last active January 12, 2021 06:36
Show Gist options
  • Save sar/471e2d1385968f93c2e04834ea363252 to your computer and use it in GitHub Desktop.
Save sar/471e2d1385968f93c2e04834ea363252 to your computer and use it in GitHub Desktop.
Emit diagnostics for all open network connections on Linux systems
#!/bin/sh
# network:devices:bound ip
ip addr
# ports:open:bound program/pid
netstat -tunlp
# active:network:connections:program
netstat -atupen | grep ESTABLISHED
# active:network:connections
# iftop -c ~/.iftoprc
lsof -nP -i
# listeners:tcp:udp
sudo lsof -nP -i | grep 'LISTEN\|UDP'
set +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment