ssh user@example.comOpen an interactive SSH session.
Comprehensive SSH client commands for login, remote execution, auth, multiplexing, jump hosts, and practical options.
Connect, run commands, and inspect versions.
ssh user@example.comOpen an interactive SSH session.
ssh -p 2222 user@example.comSpecify a custom SSH port.
ssh user@example.com 'uname -a'Execute one command remotely without opening an interactive shell.
ssh -v user@example.comShow extra connection and auth debugging details.
ssh -vvv user@example.comShow full handshake and config debugging details.
ssh -VPrint the local client version.
ssh -o BatchMode=yes user@example.com 'hostname'Disable password prompts for scripts and CI.
ssh -T git@github.comUseful in non-interactive scripts.
ssh -tt user@example.com 'sudo systemctl status nginx'Useful when the remote command expects a terminal.
ssh user@example.com 'bash -s' < ./deploy.shSend a local script to the remote shell over standard input.
Identity files, passwords, keys, and host verification.
ssh -i ~/.ssh/id_ed25519 user@example.comChoose a private key explicitly.
ssh -o PreferredAuthentications=publickey user@example.comControl which auth methods the client attempts first.
ssh -o StrictHostKeyChecking=yes user@example.comRequire the host key to already be known.
Accept first-seen host keys but still protect against changed keys.
ssh -o StrictHostKeyChecking=accept-new user@example.comAccept first-seen host keys but still protect against changed keys.
ssh -o UserKnownHostsFile=~/.ssh/known_hosts.work user@example.comStore host keys in a dedicated file.
ssh -o PasswordAuthentication=no user@example.comForce key-based auth attempts only.
ssh -o HostKeyAlgorithms=ssh-ed25519 user@example.comSpecify accepted host key algorithms explicitly.
ssh -o PubkeyAcceptedAlgorithms=+ssh-rsa user@example.comSpecify accepted client public key algorithms.
Reuse SSH sessions with control sockets.
ssh -M -S ~/.ssh/cm-%r@%h:%p user@example.comOpen a reusable control connection for later sessions.
ssh -o ControlMaster=auto -o ControlPersist=10m -o ControlPath=~/.ssh/cm-%r@%h:%p user@example.comKeep a master connection alive in the background.
ssh -S ~/.ssh/cm-%r@%h:%p -O check user@example.comQuery an existing multiplexed master socket.
ssh -S ~/.ssh/cm-%r@%h:%p -O exit user@example.comShut down a background master socket cleanly.
ssh -S ~/.ssh/cm-%r@%h:%p -O forward user@example.comAdd or adjust forwarding via an existing master connection.
ProxyJump, bastions, and chained access patterns.
ssh -J bastion.example.com user@private.internalReach an internal host via a bastion.
ssh -J bastion1.example.com,bastion2.example.com user@private.internalTraverse more than one bastion.
ssh -o ProxyCommand='ssh bastion.example.com -W %h:%p' user@private.internalTunnel through another host using ProxyCommand.
ssh -W target.internal:22 bastion.example.comUse -W for direct stream forwarding.
Compression, keepalives, escape chars, and timeouts.
ssh -C user@example.comCompress traffic for slower links.
ssh -o ConnectTimeout=5 user@example.comFail quickly if the host is unreachable.
ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=3 user@example.comSend keepalive probes to keep long sessions open.
ssh -e none user@example.comPrevent ~ escape handling in raw sessions.
Execute a client-side command when the connection is established.
ssh -o PermitLocalCommand=yes -o LocalCommand='echo connected to %n' user@example.comExecute a client-side command when the connection is established.