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 教學

整理 Linux 運維高頻指令,分類索引,適合平時查閱與面試複習。涵蓋系統資訊、資源監控、磁碟分區、網路配置、進程管理、用戶帳號、服務控制、套件查詢、檔案操作九大類。

1. 系統資訊

uname -a                 # 核心/OS/CPU 架構
head -n 1 /etc/issue     # 發行版版本
cat /proc/cpuinfo        # CPU 詳細資訊
hostname                 # 主機名
lspci -tv                # PCI 設備樹
lsusb -tv                # USB 設備樹
lsmod                    # 已載入核心模組
env                      # 環境變數

2. 資源監控

free -m                  # 記憶體/Swap 使用量 (MB)
df -h                    # 分區使用率 (人類可讀)
du -sh /path/dir         # 目錄大小
grep MemTotal /proc/meminfo
grep MemFree /proc/meminfo
uptime                   # 運行時間、負載
cat /proc/loadavg        # 1/5/15 分鐘負載

3. 磁碟與分區

mount | column -t        # 掛載狀態對齊顯示
fdisk -l                 # 所有分區表
swapon -s                # Swap 分區
hdparm -i /dev/sda       # 磁碟參數 (IDE 用 hdparm -I /dev/sda 看 SATA)
lsblk                    # 區塊設備樹 (推薦)
blkid                    # UUID/TYPE 查看

4. 網路配置

ip addr show             # 介面 IP (新)
ifconfig                 # 介面 IP (舊)
ip route show            # 路由表 (新)
route -n                 # 路由表 (舊)
ss -lntp                 # 監聽埠 (新)
netstat -lntp            # 監聽埠 (舊)
ss -antp                 # 已建立連線 (新)
netstat -antp            # 已建立連線 (舊)
netstat -s               # 網路統計
iptables -L -n -v        # 防火牆規則
firewall-cmd --list-all  # firewalld 規則

5. 進程管理

ps -ef                   # 所有進程
ps aux --sort=-%mem      # 依記憶體排序
top / htop               # 即時監控
kill -9 PID              # 強制終止
pkill -f pattern         # 按名稱殺死
pgrep -f pattern         # 查詢 PID

6. 用戶與群組

w                        # 線上用戶
id username              # 用戶 UID/GID/群組
last                     # 登入歷史
lastb                    # 失敗登入
cut -d: -f1 /etc/passwd  # 所有用戶名
cut -d: -f1 /etc/group   # 所有群組名
crontab -l               # 當前用戶排程

7. 服務控制

systemctl list-unit-files --type=service  # 所有服務狀態
systemctl start|stop|restart|status name
systemctl enable|disable name
chkconfig --list          # SysVinit 相容
chkconfig --list | grep on

8. 套件管理

rpm -qa                  # 所有 RPM 套件
rpm -ql package          # 套件安裝檔案
yum list installed       # YUM 已安裝
apt list --installed     # APT 已安裝
dpkg -l                  # Debian 套件列表

9. 檔案查看操作

cat file                 # 全文輸出
tac file                 # 反向輸出
more file                # 分頁向下
less file                # 分頁雙向 (q 退出)
head -n 10 file          # 前 10 行
tail -n 10 file          # 後 10 行
tail -f file             # 即時追蹤
nl file                  # 顯示行號
od -c file               # 八進位/字元查看
stat file                # 檔案詳細屬性

收藏建議

將此頁加入書籤,或導出為 PDF/Markdown 存入個人知識庫,遇到指令遺忘秒速查閱。

Copyright © Windows教程網 All Rights Reserved