Mac OS Xで(Pythonを使わずに)最新の20個のファイルをすばやく見つける方法は?

Mac OS Xで(Pythonを使わずに)最新の20個のファイルをすばやく見つける方法は?

もちろん、出力を取得してfind . -type f | xargs ls -lPythonスクリプトにパイプすると、行を並べ替えて上位20個を出力できます。

しかし、それより速いものがありますか?

ベストアンサー1

Mac OS X(10.10.2)では、次のことを試してください。

find . -xdev -type f -print0 | xargs -0 stat -f "%m%t%Sm %N"

statまたは直接実行

stat -f "%m%t%Sm %N" /path

~からman stat

 In order to determine the three files that have been modified most recently, you could use the following format:

       > stat -f "%m%t%Sm %N" /tmp/* | sort -rn | head -3 | cut -f2-
       Apr 25 11:47:00 2002 /tmp/blah
       Apr 25 10:36:34 2002 /tmp/bar
       Apr 24 16:47:35 2002 /tmp/foo

3を20に簡単に変更できます(-:

おすすめ記事