tle*_*man 5 ls coreutils timestamps
如何确定上次打开文件的时间?
我已经查看过man ls(使用 GNU coreutils 8.22),但没有看到有关此时间戳的任何信息。
小智 9
您可能想检查一下:
ls -l --time=atime
atime — updated when file is read
mtime — updated when the file changes.
ctime — updated when the file or owner or permissions changes.
Run Code Online (Sandbox Code Playgroud)
玩得开心!:)
尝试:
ls -lu
Run Code Online (Sandbox Code Playgroud)
如果您想按访问时间排序结果:
ls -ltu
Run Code Online (Sandbox Code Playgroud)
来自man ls:
-u with -lt: sort by, and show, access time with -l: show access
time and sort by name otherwise: sort by access time
Run Code Online (Sandbox Code Playgroud)
如果您想获得完整的日期时间,请使用--full-time:
$ ls -ltu --full-time
Run Code Online (Sandbox Code Playgroud)
或使用GNU stat:
$ stat -c "%x" -- test.txt
2014-06-30 19:21:05.481161360 +0700
Run Code Online (Sandbox Code Playgroud)