ssh user@ip -p port

首次連線會提示儲存 Host Key,選 Accept & Save。


top # 即時資源監控(負載、CPU%、記憶體、程序)
htop # 彩色互動版(需安裝)
uptime # 系統負載 1/5/15 分鐘
free -h # 記憶體使用(人類可讀)
df -h # 磁碟空間
iostat -xz 1 # 磁碟 I/O 細節

top 關鍵指標: load average < 核心數、CPU us+sy < 70%、wa < 10%、可用記憶體 > 20%
wget https://example.com/file.tar.gz # 下載
wget -c URL # 斷點續傳
scp local_file user@remote:/path/ # 上傳
scp user@remote:/path/file /local/ # 下載
rsync -avz /src/ user@remote:/dst/ # 同步備份(推薦)
vi /path/file # 進入檢視模式
i # 進入插入模式(左下顯示 --INSERT--)
Esc # 返回指令模式
:w # 存檔
:q # 離開
:wq / :x # 存檔離開
:q! # 強制不存離開
/keyword # 向下搜尋
?keyword # 向上搜尋
n / N # 下一個/上一個
chmod +x script.sh # 執行權限
chmod 755 /var/www/html # 目錄標準權限
chmod -R 777 /var/www/uploads # 遞歸全權限(僅開發測試用)
chown www:www /var/www/html # 修改擁有者:群組
chown -R www:www /var/www # 遞歸修改
mv /src/file /dst/ # 移動/重命名
cp -r /src/dir /dst/ # 複製目錄
rm file # 刪除檔案(需確認)
rm -rf dir # 強制遞歸刪除目錄(極危險,確認後再按 Enter)
tar -zcvf backup.tar.gz /path # 打包壓縮
tar -zxvf backup.tar.gz # 解壓縮
unzip file.zip # 解壓 zip
ping -c 4 8.8.8.8 # 連通性測試
netstat -ntlp # TCP 監聽埠
ss -ntlp # 現代替代 netstat
echo "nameserver 8.8.8.8" >> /etc/resolv.conf # 設定 DNS
service sshd restart # SysVinit
systemctl restart sshd # systemd
systemctl enable sshd # 開機自啟
systemctl status sshd # 狀態查看
^H^H 亂碼chmod 600 ~/.ssh/id_rsa)、AuthorizedKeysFile 路徑錯誤LANG=zh_TW.UTF-8),檔案系統支援 UTF-8ssh -L 8080:localhost:80 user@server 將遠端 80 映射到本地 8080ssh-copy-id user@server 推送公鑰ControlMaster auto ControlPath ~/.ssh/cm-%r@%h:%p 加速多連線ssh -J bastion user@target (OpenSSH 7.3+)