What Is SSH?
SSH (Secure Shell) is an encrypted network protocol for securely accessing remote servers. It uses TCP port 22 by default and encrypts all transmitted data.
Connecting to Your VPS
Password Login
ssh root@your_server_ip
# First connection will ask to confirm the fingerprint — type 'yes'
# Then enter your password (characters won't show — that's normal)Key-Based Authentication (Recommended)
Step 1: Generate a key pair
# Run on your local machine (Windows/macOS/Linux)
ssh-keygen -t ed25519 -C "[email protected]"
# Press Enter for default path, optionally set a passphraseStep 2: Copy your public key to the server
ssh-copy-id -i ~/.ssh/id_ed25519.pub root@your_server_ip
# Or manually append the public key to ~/.ssh/authorized_keysStep 3: Verify passwordless login
ssh root@your_server_ip
# If no password is required, key auth is workingEssential Command Reference
Files & Directories
| Command | Description |
|---|---|
| ls -la | List all files including hidden ones |
| cd /path/to/dir | Change directory |
| mkdir -p dir1/dir2 | Create directories recursively |
| cp -r source dest | Copy files/directories recursively |
| mv old new | Move or rename |
| rm -rf dir | Force delete recursively (use with caution) |
| find / -name "*.log" | Search files globally |
System & Processes
| Command | Description |
|---|---|
| top / htop | Real-time CPU and memory usage |
| df -h | Disk usage overview |
| free -h | Memory usage overview |
| ps aux | List all running processes |
| systemctl status nginx | Check service status |
| uname -a | Display kernel version |
| uptime | System uptime and load averages |
File Transfer
SCP (Secure Copy)
# Upload a file
scp local_file.txt root@server_ip:/root/
# Download a file
scp root@server_ip:/root/remote_file.txt ./
# Upload a directory
scp -r local_dir root@server_ip:/root/rsync (Incremental Sync)
# Sync local directory to server (only transfers changed files)
rsync -avz ./local_dir/ root@server_ip:/remote_dir/