bash ls | 排序降序 | 取(n)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14870093/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 04:33:40  来源:igfitidea点击:

bash ls | sort desc | take (n)?

linuxbash

提问by T. Webster

What is a short way to do something like lssort by date descending Take(4) files?

执行ls按日期降序Take(4) 文件排序之类的快捷方式是什么?

回答by Erik

Use ls -rt | head -n 4- sort by time, reverse, grab 4 first lines

使用ls -rt | head -n 4——按时间排序,倒序,抢前4行