ssh

Securely connect to a remote host over an encrypted SSH tunnel.

medium risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

ssh creates an encrypted connection to a remote machine. Key-based authentication (-i) is strongly preferred over passwords. -J enables jump host proxying through bastion servers. -L/-R set up local/remote port forwarding tunnels.

Common flags
FlagMeaning
-iSpecify private key file for authentication
-pConnect to a non-standard SSH port
-LLocal port forwarding: tunnel a remote port to localhost
-RRemote port forwarding: expose local port on remote host
-JJump/bastion host proxy
-NDo not execute a remote command (useful for tunnels)
-vVerbose mode for debugging connection issues
Examples
ssh -i ~/.ssh/prod.pem [email protected]Connect to EC2 instance with a PEM key · explain & risk-check →
ssh -L 5432:db.internal:5432 bastion.hostTunnel PostgreSQL through bastion to localhost:5432 · explain & risk-check →
ssh -J bastion.host [email protected]Connect to private server through a jump/bastion host · explain & risk-check →
Pro tip

Configure `~/.ssh/config` with Host aliases — replace `ssh -i key.pem -p 2222 [email protected]` with just `ssh prod`.

Related
scp rsync ssh-keygen ssh-copy-id
Open the full explainer →More in Networking

Reference text is hand-written and may be incomplete — check man ssh for your version. Test destructive commands on a non-production system first.