简体   繁体   English

Kornshell(ksh)列表/排序文件

[英]Kornshell (ksh) listing/sorting files

How would I sort files by modification time (most recent at the top) and only have one column? 我如何按修改时间对文件进行排序(最近一次在顶部),并且只有一列?

I tried: 我试过了:

    ls -1 | ls -lt

and

    ls -lt | -1

but the first has extraneous columns, and the second lists them in one column, but in the wrong order. 但第一列有多余的列,第二列将它们列在一个列中,但顺序错误。

ls "filepath" -t -1 

this will sort the date last modified and print out 1 row at a time. 这将对上次修改的日期进行排序,并一次打印出1行。

I don't think you can do both with piping unless you want to have it list twice. 我不认为您可以同时使用管道,除非您希望两次列出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM