What does ssh do?

log in to or run a command on a remote machine.

▸ Explain your own ssh command →

ssh examples, explained

$ ssh -i key.pem -p 2222 user@host

  • sshlog in to or run a command on a remote machine
  • -iuse the given private key file
  • key.pemvalue for -i
  • -pconnect to this port
  • 2222value for -p
  • user@hostan argument passed to the command

$ ssh -N -L 8080:localhost:80 host

  • sshlog in to or run a command on a remote machine
  • -Ndo not run a remote command (forwarding only)
  • -Lset up local port forwarding
  • 8080:localhost:80value for -L
  • hostan argument passed to the command

ssh flags & options

-iuse the given private key file
-pconnect to this port
-Lset up local port forwarding
-Rset up remote port forwarding
-Dset up a local SOCKS proxy (dynamic forwarding)
-Ndo not run a remote command (forwarding only)
-fgo to the background after authenticating
-vverbose — print debugging output
-tforce a pseudo-terminal
-oset an ssh_config option (e.g. StrictHostKeyChecking=no)

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.