萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 電腦基礎知識 >  >> 電腦入門

Linux 系統 8 個實用指令實戰範例教學

透過處理訂單日誌實戰,示範 8 個核心 Linux 指令用法,適合初學者快速上手。

範例資料

order.out.log
8:22:19 111, 1, Patterns of Enterprise Architecture, Kindle edition, 39.99
8:23:45 112, 1, Joy of Clojure, Hardcover, 29.99
8:24:19 113, -1, Patterns of Enterprise Architecture, Kindle edition, 39.99

order.in.log
8:22:20 111, Order Complete
8:23:50 112, Order sent to fulfillment
8:24:20 113, Refund sent to processing

cat - 串接檔案並輸出

cat order.out.log          # 顯示單一檔案
cat order.*                # 串接所有 order 開頭檔案

sort - 文字逐行排序

cat order.* | sort         # 合併後按時間排序

大量日誌時,建議搭配管道傳遞給過濾工具(如 grep、awk)進一步處理。

其他常用指令預告

後續將介紹 grep、awk、sed、cut、uniq、wc、find 等指令進階用法。

copyright © 萬盛學電腦網 all rights reserved