寻找返回目录中最新文件的命令。
没有看到ls的limit参数…
寻找返回目录中最新文件的命令。
没有看到ls的limit参数…
当前回答
我使用:
ls -ABrt1——group- directory -first | tail -n1 . ls -ABrt1——group- directory -first | tail -n1 . ls
它只给我文件名,不包括文件夹。
其他回答
ls -Frt | grep "[^/]$" | tail -n 1
根据模式在每个目录中查找最新的文件,例如工作目录的子目录的名称以“tmp”结尾(不区分大小写):
find . -iname \*tmp -type d -exec sh -c "ls -lArt {} | tail -n 1" \;
假设您不关心以a开头的隐藏文件。
ls -rt | tail -n 1
否则
ls -Art | tail -n 1
使用R递归选项..你可以认为这是对好的答案的增强
ls -arRtlh | tail -50
我喜欢echo *(om[1]) (zsh语法),因为它只给出文件名,而不调用任何其他命令。