SSH Cheat Sheet/Set connect timeout

Fail quickly if the host is unreachable.

Section: Useful Options

Set connect timeout

bash
bash
ssh -o ConnectTimeout=5 user@example.com
Explanation

Fail quickly if the host is unreachable.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Useful Options
Configure keepalives
Send keepalive probes to keep long sessions open.
OpenIn sheetbashsame section
Enable compression
Compress traffic for slower links.
OpenIn sheetbashsame section
Disable escape character
Prevent ~ escape handling in raw sessions.
OpenIn sheetbashsame section
Run a local command after connect
Execute a client-side command when the connection is established.
OpenIn sheetbashsame section
Connect to a host
Open an interactive SSH session.
OpenIn sheetbash1 tag match
Use a specific private key
Choose a private key explicitly.
OpenIn sheetbash1 tag match