#author("2022-11-12T23:09:52+09:00","","")
#author("2025-11-07T19:02:46+09:00","","")
#topicpath


///////////////////////////////////////////////////////////////////////////////
* 目次 [#x4f92252]
#contents();

///////////////////////////////////////////////////////////////////////////////
* find [#e4f6a320]

///////////////////////////////////////////////////////////////////////////////
* 使い方 [#cab8b8d3]
- 詳しくは、 man find を参照
//=============================================================================
** 複数パターンのファイル名を or 条件で検索する [#yc48b874]
- *.cc か *.h に当てはまるファイルをリストする
 $ find . \( -name '*.cc' -o -name '*.h' \)
 ./des_old.h
 ./des_ver.h
 ./rpc_des.h
 ./spr.h
 ./des.h
 ./des_locl.h
 ./times/aix.cc
 ./times/alpha.cc
 ./times/hpux.cc
 ./times/usparc.cc


//=============================================================================
** 一定のファイルサイズ以上のファイルの検索 [#g03f921a]
 $ find . -size +100M   # 100M以上のファイルを検索

//=============================================================================
** 実行可能ファイルの検索 [#i936f001]
 $ find . -executable -type f

 $ find . -perm /u=x,g=x,o=x -type f

//=============================================================================
** ELF のみ検索 [#ld9c862b]
 $ find . -executable -type f -exec file {} \; | grep -i elf
** 特定ファイルタイプを対象とした検索 [#c93029a8]
- ''-type <type>'' を使う
- <type> で使用出来るもの
|~<type> |~description                 |~remark       |
|b       |ブロックスペシャルファイル   |バッファあり  |
|c       |キャラクタスペシャルファイル |バッファなし  |
|d       |ディレクトリ                 |              |
|p       |名前付きパイプ               |FIFO          |
|f       |通常ファイル                 | |
|l       |SymLink                      |-L, -follow が有効な場合、SYmLinkが切れている場合を除き true になることはない。-C が有効な場合に SymLink を検索するには、 -xtype を使用すること |
|s       |ソケット                     |              |
|D       |ドア                         |Soralisの場合 |

 $ find . -exec file {} \; | grep -i elf


//=============================================================================
** 最終更新日時付きで表示する [#peb61f72]
 $ find -printf "%TY-%Tm-%Td %TT+%TZ %p\n"
 2016-12-03 21:18:15.0645873030+JST .
 2010-06-29 07:16:27.0000000000+JST ./acinclude.m4
 2012-08-04 23:25:20.0000000000+JST ./aclocal.m4
 2010-06-29 07:16:25.0000000000+JST ./AUTHORS
 2012-08-04 23:24:51.0000000000+JST ./ChangeLog
 2012-06-15 23:08:23.0000000000+JST ./compile
 2012-06-15 23:08:23.0000000000+JST ./config.guess

- 
 $ find -printf "%TY-%Tm-%Td %TT+%TZ %p\n" | perl -pe "s/\..*\+JST/\+JST/"
 2016-12-03 21:18:15+JST .
 2010-06-29 07:16:27+JST ./acinclude.m4
 2012-08-04 23:25:20+JST ./aclocal.m4
 2010-06-29 07:16:25+JST ./AUTHORS
 2012-08-04 23:24:51+JST ./ChangeLog
 2012-06-15 23:08:23+JST ./compile
 2012-06-15 23:08:23+JST ./config.guess

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS