Linux 搜尋檔案中的字串(grep)

搜尋某個目錄下的所有檔案內容是否包含某個字串,可以使用grep來達到
grep -rnw ‘目錄’ -e ‘要搜尋的字串’

  • -r or -R is recursive (遞迴,包含搜尋子目錄)
  • -n is line number (顯示行號)
  • -w stands for match the whol[……]

    Read more