Unix上的文件修改时间(秒) [英] File modification time (seconds) on Unix

查看:293
本文介绍了Unix上的文件修改时间(秒)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unix上,是否有命令显示文件的修改时间,精确到秒?

On Unix, is there a command to display a file's modification time, precise to the second?

在Linux上,可以使用"stat -c%y"轻松完成此操作,该命令返回类似2009-11-27 11:36:06.000000000 +0100的内容.我在Unix上找不到等效的文件.

On Linux this is easily done with a "stat -c %y", which returns something like 2009-11-27 11:36:06.000000000 +0100. I found no equivalent on Unix.

推荐答案

我发现了这一点:

ls --time-style='+%d-%m-%Y %H:%M:%S' -l

哪个会导出以下内容:

root:~# ls --time-style='+%d-%m-%Y %H:%M:%S' -l
total 0
-rw-r--r-- 1 root root 0 16-04-2015 23:14:02 other-file.txt
-rw-r--r-- 1 root root 0 16-04-2015 23:13:58 test.txt

这篇关于Unix上的文件修改时间(秒)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆