Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux 系統管理高頻指令速查表:進程、網路、備份、計時一覽

編輯:Linux 教學

10 條實用單行指令

用途指令說明
Top 10 記憶體進程ps aux | sort -nk +4 | tail依 %MEM 排序顯示前 10
即時監控目錄變化watch -d -n 1 'df; ls -FlAt /path'每秒重繪,高亮差異
歷史指令使用統計history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head找出最常用前 10 指令
Vim 無權存檔強制寫入:w !sudo tee %利用 tee 以 root 權限覆寫
簡易計時器time read按 Enter 停止,顯示經過時間
快速建立空檔> file.txt等同 touch file.txt
快速備份檔案cp filename{,.bak}大括號展開自動加 .bak
定時任務:單次 at / 循環 cronecho cmd | at midnight明天午夜執行一次
查看端口佔用netstat -tulnp顯示 TCP/UDP 監聽端口與 PID
秒開 SMTP 測試服務python -m smtpd -n -c DebuggingServer localhost:1025輸出郵件內容到終端
當前目錄即時 HTTP 服務python -m SimpleHTTPServer預設 8000 端口,https://IP:8000
遞歸下載整站wget --random-wait -r -p -e robots=off -U Mozilla www.example.com鏡像站點,繞過 robots.txt

進階組合範例

尋找佔用空間最大的 20 個檔案

find / -type f -exec du -h {} + 2>/dev/null | sort -hr | head -20

批次殺死特定使用者進程

pkill -u username

SSH 連線保持(防斷線)

# 客戶端 ~/.ssh/config
Host *
    ServerAliveInterval 60
    ServerAliveCountMax 3

快速產生強密碼

openssl rand -base64 32
Copyright © Windows教程網 All Rights Reserved