Cheatsheet: ssh
Last updated 2026-06-21
Connecting
Connect to a host as the current user
Connect as a specific user
Connect on a custom port
Use a specific private key file
Run a remote command without opening an interactive shell
Keys and agent
Generate a modern Ed25519 key pair
Copy your public key to a server
Start the ssh-agent and add a key
List keys loaded in the agent
Configuration
Define a reusable host in ~/.ssh/config
Connect using a configured host alias
Use a jump host
Enable agent forwarding for one connection
Forwarding and copy
Forward a local port to a remote service
Forward a remote port back to your local machine
Create a SOCKS proxy
Copy a local file to a remote host
Copy a remote file to the current directory
See also: