[Shell command] find で直近 N 分以内に更新されたファイルを検索する
作成日: 2026年10月05日
GNU find で直近 N 分以内に更新されたファイルを検索するには、-mmin を使用します。
下記の例では、直近 10 分以内に更新された通常ファイルだけを検索します。
mkdir -p sample
touch sample/recent.txt
touch -d '20 minutes ago' sample/old.txt
find sample -type f -mmin -10
実行結果は下記のとおりです。
sample/recent.txt
-type f は検索対象を通常ファイルに限定します。-mmin -10 は、更新されてから 10 分未満のファイルを対象にします。
この例の touch -d は GNU coreutils の書式です。