2011-11-09 00:47:57 +0000 2011-11-09 00:47:57 +0000
188
188
Advertisement

如何让Linux的ls命令在时间戳中显示第二位?

Advertisement

关于ls -l命令的烦人之处在于它只显示一个文件的小时和分钟(比如08:30)。我怎样才能看到第二部分(比如08:30:44)?

man 1 ls和搜索'second'没有任何线索。

Advertisement
Advertisement

答案 (6)

199
199
199
2011-11-09 01:02:33 +0000

你的ls版本是否支持--time-style选项?如果支持:

ls -la --time-style=full-iso blah

-rw-r--r-- 1 root root 0 2011-11-08 18:02:08.954092000 -0700 blah
```。
98
98
98
2015-10-10 09:13:24 +0000

更简单的方法是:

ls --full-time

这等于

ls -l --time-style=full-iso

如果你想把条目显示为.开头的隐藏文件,请添加-a

ls --full-time -a
39
Advertisement
39
39
2015-11-12 00:44:55 +0000
Advertisement

对于 OS X 来说,似乎你能得到的最好的结果是:

ls -l -T

0x1&

从10.10.5上的ls(1) manpage:

-T 与-l(小写字母``ell’‘)选项一起使用时,显示文件的完整时间信息,包括月、日、时、分、秒和年。

20
20
20
2014-07-25 21:28:48 +0000

如果"-time-style=full-iso “的输出对你来说太过详细,你可以使用像日期命令一样的自定义格式。

ls -l --time-style=+"%b %d %Y %H:%M:%S" blah
-rw-rw-r-- 1 root root 0 Feb 03 2014 01:13:01 blah
3
Advertisement
3
3
2014-11-10 09:50:02 +0000
Advertisement

关于man ls指令,只需ls -e就可以了!

1
1
1
2015-10-23 10:23:11 +0000

对于FreeBSD来说,它应该是。

ls -la -D %Y-%m-%dT%H:%M:%S
Advertisement

相关问题

6
10
5
37
6
Advertisement