Unix 基本指令操作

IO Redirection: File Descriptors
file descriptor 0 is associated with STDIN, 1 with STDOUT, and 2 with STDERR.
ex: 2>&1 將 錯誤訊息(STDERR) 直接導向 標準輸出(STDOUT)
ex: 2>& > /tmp/output
ex: >& > /tmp/output (標準輸出 輸入都一起導到 /tmp/output file)

< input file : read standard input from file
> output file : write standard output to file
>> output file: append standard output to file
>& error file : write error message to file
| command2 : pipe output as input for command2

ex: ls 2>/dev/null 1>/tmp/output
& => 指定到 &1 的變數(不然會變成 1 的 file)


-name '*stuff*'
-mtime +5 : find files modified name then 5 days.
-mtime -5 : find files modified less then 5 days ago.
-size +1024c: find files bigger then 1k bytes.
-print: find full filenames meeting previous criteria.
-ls : find file name and other information.
-exec rm {} ; : Remove the file meeting previous criteria.

-b: ignore Blank Spaces
-c: show more of the content.

關於 Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.
本篇發表於 My_Note-Unix。將永久鏈結加入書籤。

Unix 基本指令操作 有 2 則回應

  1. JOY 說道:


  2. Tsung 說道:

    搭配 grep 來做應該比較簡單.