2022-11-14|閱讀時間 ‧ 約 3 分鐘

Linux FAQ : find 用法

Linux FAQ : find 用法
find 目錄 參數 條件
參考 :
find . -type d 'xxx*'
參數
  • 目錄搜尋層數
  • maxdepth 第幾層
  • find . -maxdepth 1
  • 忽略特定目錄
  • -not -path 目錄
  • find . -name '123' -not -path './usr/*'
  • path 目錄 -prune -o
  • find . -path ./usr -prune -o -name '123'
  • -user 使用者
  • find . -user topstd -name '*' -exec ls -l {} \\;
  • 排除 使用者
  • find . ! -user topstd -name '*' -exec ls -l {} \\;
  • -szie 大小
  • find . -size +10k
  • 小於 10 k
  • find . -size -10k
The shell redirection, is being done at first, a file named {} is being created before even the find starts and the strings (the number of files are in there) are being written to the file {}.
You need:
find . -type f -exec bash -c 'echo "This file found" >>"$1"' _ {} \\;
分享至
成為作者繼續創作的動力吧!
從 Google News 追蹤更多 vocus 的最新精選內容從 Google News 追蹤更多 vocus 的最新精選內容

發表回應

成為會員 後即可發表留言