简体   繁体   English

使用ls命令显示文件按复制时间排序?

[英]use ls command show files sort by copy time?

I have a remote machine and I scp -ed a bunch files from the host. 我有一台远程机器,我scp从主机-ed一堆文件。 I want to use ls command to show these files, sorted by copied time. 我想使用ls命令显示这些文件,按复制的时间排序。 How can I do this? 我怎样才能做到这一点?

I tried ls -lt but it doesn't seem right. 我试过ls -lt但它似乎不对。 It only shows the file created time, not my copying time. 它只显示文件创建时间,而不是我的复制时间。

ls -lt does not show file creation time...because most Unix filesystems do not actually record the file creation time. ls -lt不显示文件创建时间...因为大多数Unix文件系统实际上不记录文件创建时间。 For those that do, it's not necessarily easy to get at it (with ext4 you can use the debugfs command ( doc ), but that's not really germane to your question). 对于那些做的人来说,它并不一定容易实现(使用ext4你可以使用debugfs命令( doc ),但这与你的问题没有密切关系)。

The -t flag by default sorts by modification time. 默认情况下, -t标志按修改时间排序。 You can use the inode change time ( ctime ) by adding the -c flag, so -lct . 您可以通过添加-c标志来使用inode更改时间( ctime ),所以-lct

It's possible that sorting by the inode change time may get you what you want, since this gets updated when the file metadata (size, ownership, permissions) is changed, which will happen when you create a new file. 按照inode更改时间排序可能会得到您想要的内容,因为当文件元数据(大小,所有权,权限)发生更改时会更新,这将在您创建新文件时发生。

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

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