Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Linux 常用基礎命令速查手冊:系統操作、文件管理、Vi 編輯器核心指令

編輯:Linux 系統常見問題解答

整理 Linux 日常運維、開發最高頻的基礎命令,涵蓋系統控制、文件操作、Vi 編輯器、軟件包管理,按功能分類,適合新手入門速查、老手案頭備忘。

系統控制與會話

命令作用備註
startx啟動圖形界面運行級別 5 或手動啟動
shutdown -h now立即關機-h halt,now 立即
shutdown -r now立即重啟-r reboot
reboot重啟等同 shutdown -r now
logout註銷當前用戶圖形界面用「登出」

Vi/Vim 編輯器核心操作流

  1. vi 文件名:打開/創建文件,進入正常模式
  2. i:進入插入模式(左下角顯示 --INSERT--)
  3. Esc:返回正常模式
  4. ::進入命令行模式(底行輸入命令)
  5. :wq:保存並退出
  6. :q!:不保存強制退出

進階必會::w 新文件名 另存、:set nu 顯示行號、dd 刪除行、yy 復制行、p 粘貼、u 撤銷、/關鍵字 搜索。

文件與目錄操作

命令核心參數典型用法
ls-l 詳情 -a 隱藏 -h 人類可讀 -t 時間排序 -r 反序ls -lahrt 巡檢首選
cd~ 家目錄 - 上一目錄 .. 父目錄cd - 來回切換極快
pwd-P 物理路徑確認符號鏈接真實位置
mkdir-p 遞歸創建mkdir -p a/b/c
rm-f 強制 -r 遞歸 -i 交互慎用 rm -rf,建議別名 alias rm='rm -i'
cp-r 遞歸 -p 保留屬性 -f 強制cp -rp src/ dst/
mv-f 強制 -i 交互重命名、移動同命令
find-name -type -size -user -execfind . -name "*.log" -size +10M -exec rm -f {} +

文件查看與處理

命令用途經典組合
cat顯示全文cat file | grep keyword
less分頁查看(可上下翻頁、搜索)less /var/log/messages
head/tail頭/尾部行tail -f /var/log/nginx/access.log 實時追蹤
grep模式搜索grep -rn "error" /var/log/
wc統計行/詞/字節wc -l file

壓縮與解壓

  • tar -zcvf a.tar.gz dir/ / tar -zxvf a.tar.gz
  • zip -r a.zip dir/ / unzip a.zip

網絡基礎

  • ping IP、curl URL、wget URL
  • netstat -anpt / ss -anpt 端口監聽
  • scp file user@ip:/path 跨機傳輸

進程管理

  • ps -aux | grep 進程名
  • top / htop 動態監控
  • kill -9 PID 強制終止

權限與擁有者

  • chmod 755 file / chown user:group file
  • chmod -R 755 dir/ 遞歸修改

軟件包管理

發行版安裝更新搜索卸載
CentOS/RHEL (yum/dnf)yum install pkgyum updateyum search pkgyum remove pkg
Debian/Ubuntu (apt)apt install pkgapt update && apt upgradeapt search pkgapt remove pkg

獲取幫助

  • man 命令:權威手冊
  • 命令 --help:快速參數列表
  • info 命令:GNU 信息頁(更詳細)
Copyright © Windows教程網 All Rights Reserved