Network
ssh
OpenSSH client for secure remote login and command execution.
Synopsis
syntax
ssh [OPTION]... [USER@]HOST [COMMAND]
Examples
Connect to remote server
ssh [email protected]
Connect on non-standard port
ssh -p 2222 user@host
Connect with specific key
ssh -i ~/.ssh/key.pem ec2-user@host
Local port forward
ssh -L 8080:localhost:80 user@host
Run remote command
ssh user@host 'df -h'
Common options
| Flag | Description |
|---|---|
| -p | Port number |
| -i | Identity file (private key) |
| -L | Local port forwarding |
| -R | Remote port forwarding |
| -D | Dynamic SOCKS proxy |
| -v | Verbose for debugging |
| -N | No command — for port forwarding only |
About ssh
The `ssh` command openSSH client for secure remote login and command execution. Networking commands handle connectivity testing, DNS resolution, data transfer, remote access, firewall rules, and traffic analysis.
Linux is the dominant server operating system, and strong networking skills are essential for web hosting, container orchestration, security auditing, and infrastructure management. The command accepts 7 commonly used flags shown above, though the full set of options is available in the man page (`man ssh`).
The 5 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Network Commands
Other commands in the Network category