diff --git a/README.md b/README.md index 640a5fc..1635502 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_602 TILs and counting..._ +_603 TILs and counting..._ --- @@ -537,6 +537,7 @@ _602 TILs and counting..._ - [Exclude A Directory With Find](unix/exclude-a-directory-with-find.md) - [File Type Info With File](unix/file-type-info-with-file.md) - [Find Newer Files](unix/find-newer-files.md) +- [Forward Multiple Ports Over SSH](unix/forward-multiple-ports-over-ssh.md) - [Get The Unix Timestamp](unix/get-the-unix-timestamp.md) - [Global Substitution On The Previous Command](unix/global-substitution-on-the-previous-command.md) - [Globbing For All Directories In Zsh](unix/globbing-for-all-directories-in-zsh.md) diff --git a/unix/forward-multiple-ports-over-ssh.md b/unix/forward-multiple-ports-over-ssh.md new file mode 100644 index 0000000..35191ce --- /dev/null +++ b/unix/forward-multiple-ports-over-ssh.md @@ -0,0 +1,20 @@ +# Forward Multiple Ports Over SSH + +I sometimes find myself doing web app development on another machine via an SSH +connection. If I have the server running on port 3000, then I like to use +SSH's port forwarding feature so that I can access `localhost:3000` on my +physical machine. + +```bash +$ ssh dev@server.com -L 3000:localhost:3000 +``` + +What if I have two different servers running? I'd like to port forward both +of them -- that way I can access both. + +SSH allows you to forward as many ports as you need. The trick is to specify +a `-L` for each. + +```bash +$ ssh dev@server.com -L 3000:localhost:3000 -L 9009:localhost:9009 +```