File Transfer & Tunneling
SCP, SFTP & rsync
scp file.txt user@host:/remote/path/ # local -> remote
scp user@host:/remote/file.txt . # remote -> local
scp user@host1:/path/file user@host2:/path/ # remote -> remote, streams directly
sftp user@host # interactive session, ls/cd/get/put
# rsync — incremental/delta transfer, resumable, more efficient re-syncing
rsync -avz ./dist/ user@host:/var/www/app/Port Forwarding
# Local forwarding — access a remote-only service through your local port
ssh -L 8080:localhost:5432 user@dbserver
# now localhost:8080 on YOUR machine tunnels to port 5432 on dbserver
# Remote forwarding — expose a local service to the remote side
ssh -R 9000:localhost:3000 user@remotehost
# remotehost:9000 now tunnels back to port 3000 on YOUR machine
# Tunnel only, no interactive shell, run in background
ssh -N -f -L 8080:localhost:80 user@hostJump Hosts & Agent Forwarding
ssh -J bastion-host target-host # jump through an intermediary in one command
# Agent forwarding — the remote host uses YOUR local agent's keys to
# authenticate onward, without your private key ever being copied there.
# Only enable for genuinely TRUSTED intermediate hosts — anyone with
# sufficient privileges on that host could use your forwarded agent
# while your session is active.
ssh -A user@bastion-hostKeep your own version of these notes — editable, searchable, and organised by your stack.
Start free