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"' _ {} \\;

留言

這個網誌中的熱門文章

冒險者 1-4 part 2

部落衝突

Fantech EG1 立體聲入耳式電競耳機 開箱文 2018/07