grep(Global Regular Expression Print)搜尋
grep -r "XXX" (XXX:要搜尋的內容)grep -r "XXX" . (XXX:要搜尋的內容, . 當前目錄下,可省略)
grep -rn "XXX" (XXX:要搜尋的內容並顯示行號)
grep -ri "XXX" (XXX:要搜尋的內容,忽略關鍵字大小寫)
grep -r "XXX" * (XXX:只在.c.h檔內搜尋XXX)
grep -r "XXX" YYY.c (在YYY.c檔案內搜尋XXX)
grep -r "XXX" /home/yyy (在指定路徑/home/yyy內搜尋XXX)
grep -r "XXX" YYY.c (在YYY.c檔案內搜尋XXX)
grep -r "XXX" /home/yyy (在指定路徑/home/yyy內搜尋XXX)
grep -r "XXX" --include="*.h"(只在.h內搜尋XXX)
grep -w "XXX" 完全符合該XXX
grep -rin "XXX"
在目錄下找檔案
ls | grep "XXX" (XXX:檔案名稱)