Connecting to remote machines, managing keys, tunnelling ports and moving files securely. Real OpenSSH client commands — the same ones you would type on a laptop to reach a server, Raspberry Pi or VPS from your phone.
Print or save this page for offline reference.
Connecting
Command
Description
ssh user@host
Open a shell on a remote host.
ssh -p 2222 user@host
Connect on a non-default port.
ssh -i key.pem user@host
Authenticate with a specific private key.
ssh user@host 'cmd'
Run a single command remotely and exit.
Keys
Command
Description
ssh-keygen -t ed25519
Generate a modern Ed25519 key pair.
ssh-copy-id user@host
Install your public key on the server.
ssh-add key
Load a private key into the SSH agent.
chmod 600 ~/.ssh/id_ed25519
Lock down key permissions (required by SSH).
Tunnels & forwarding
Command
Description
ssh -L 8080:localhost:80 host
Local forward: reach a remote port locally.
ssh -R 9000:localhost:3000 host
Remote forward: expose a local port on the server.