Bringing a remote service to your localhost
Local port forwarding creates a tunnel from a port on your local machine to a port on the remote side. The remote service feels like it's running locally. Pattern: a database, web app, or admin UI runs on the remote server but isn't exposed to the network — local forwarding gives you private access.
The mental model
Syntax: -L local-port:remote-host:remote-port. The remote-host is resolved from the SSH server's perspective, not yours. So -L 8080:localhost:80 means "forward my localhost:8080 to whatever the server calls localhost — that is, the server itself." To reach a third host through the server, swap localhost for that third host's address.