Gam*_*120 6 shell bash find xargs stat
我基本上想结合输出
find /
Run Code Online (Sandbox Code Playgroud)
输出为:
find / | xargs -L1 stat -c%Z
Run Code Online (Sandbox Code Playgroud)
第一个命令列出 / 目录中的文件,第二个命令列出每个文件的时间戳。我想将这两者结合起来,这样我就可以得到文件和时间戳,例如:
/path/to/file 1501834915
Run Code Online (Sandbox Code Playgroud)
mur*_*uru 11
如果你有 GNU find,你可以完全使用find
:
find / -printf '%p %C@\n'
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)find / -printf '%p %C@\n'
如果您不需要小数部分,请使用s
代替@
作为时间格式说明符。(有一些系统没有s
,但 Linux 和 *BSD/OSX 确实有s
。)
%p File's name.
%Ck File's last status change time in the format specified by
k, which is the same as for %A.
%Ak File's last access time in the format specified by k,
which is either `@' or a directive for the C `strftime'
function. The possible values for k are listed below;
some of them might not be available on all systems, due
to differences in `strftime' between systems.
@ seconds since Jan. 1, 1970, 00:00 GMT, with
fractional part.
Run Code Online (Sandbox Code Playgroud)