Linux Commands Helper
💬 Your AI-powered Linux assistant
ssh Command - Secure Shell
The ssh command is used to securely connect to a remote server or system over a network using the SSH protocol. It provides encrypted communication and is commonly used for remote login and command execution.
Syntax
ssh [options] [user@]hostname [command]
Examples
ssh user@example.com
Connect to the remote host example.com
as user user
.
ssh -p 2222 user@example.com
Connect to example.com
on port 2222 as user user
.
ssh -i ~/.ssh/id_rsa user@example.com
Use a specific private key file for authentication.
ssh user@example.com 'ls -l /var/www'
Run a command on the remote server after connecting.
Notes
- SSH uses port 22 by default unless specified otherwise with
-p
. - Public/private key authentication is recommended for better security.
- SSH can be used for tunneling, file transfer (with
scp
/sftp
), and port forwarding.