Created
September 7, 2019 11:19
-
-
Save laurentsenta/658039086c6ddb32b917ad59a4412499 to your computer and use it in GitHub Desktop.
my "favorite" shell function
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
tunnel () { | |
machine="$1" | |
port_local="$2" | |
port_remote="$2" | |
if [ ! -z "$3" ] | |
then | |
port_remote="$3" | |
fi | |
echo "ssh $machine -N -L \"${port_local}:localhost:${port_remote}\"" | |
ssh $machine -N -L "${port_local}:localhost:${port_remote}" | |
} | |
# Now you may: | |
# tunnel MyServer 8001 4001 | |
# tunnel MyServer 27017 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment