LoginSignup
2
2

More than 5 years have passed since last update.

過去10時間以内に変更されたファイルの一覧を表示

Posted at

要旨

find コマンドのオプションは多くて覚えられないのでメモ:

過去10時間以内に変更されたファイルの一覧を表示するワンライナー

$ find . -type f -mmin -600 -ls | grep -vE '(.git|vendor|cache)'
1620576      4 -rw-rw-r--   1 vagrant  vagrant      1430 10月  5 10:31 ./app/Console/Commands/Ec2.php
202280504    4 -rw-rw-r--   1 vagrant  vagrant       676 10月  5 14:28 ./app/Console/Kernel.php
202256454    4 -rw-rw-r--   1 vagrant  vagrant      1416 10月  5 14:27 ./app/Providers/AppServiceProvider.php
134811661   12 -rw-rw-r--   1 vagrant  vagrant      9530 10月  5 14:36 ./config/app.php
202572472 1036 -rw-rw-rw-   1 vagrant  vagrant   1055244 10月  5 14:26 ./storage/logs/laravel.log

find のオプション

  • .
    • 検索開始ディレクトリ
  • -type f
    • ファイルのみ(ディレクトリは表示しない)
  • -mmin -600
    • 過去600分以内
  • -ls

    • ls -l 形式で表示
  • | (パイプ)以降(ここは find とは無関係)

    • パス名に .git, vendor, cache が含まれるものを除く(適宜お好みで)

あとがき

今回の環境は CentOS7 ですが、日本語環境での ls -l 実行時に日付が"99月99"になって "日" が表示されないという、coreutils(?) のバグが直る日は来るのでしょうか?(『RHELでユーザー登録している正規ユーザーさんからの、正式なバグ報告がないと直せないんすよ~』みたいなことを、むかし誰かが呟いていたような気もしますが…。)

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2