Skip to content

Instantly share code, notes, and snippets.

@anthonywu
Created December 15, 2014 20:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonywu/04b06da03115be26afab to your computer and use it in GitHub Desktop.
Save anthonywu/04b06da03115be26afab to your computer and use it in GitHub Desktop.
ssh tunnel management
# check for running ssh processes that look like tunneling processes
ps -eo command | grep "ssh.*\-[L] .*/.*/.*" || echo "No Existing Tunnels"
# This script closes all ssh processes that look like local tunnels
for pid in $(ps -ef | grep "[s]sh.*-L" | awk '{ print $2 }'); do
kill -TERM $pid;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment