日期:2014-05-16  浏览次数:20727 次

linux查看文件时间精确到秒
Linux 下查看文件时,ls –l 缺省是不显示秒的:
-rw------- 1 root root  1463 Jul 25  2012 anaconda-ks.cfg
-rw-r--r-- 1 root root    11 Feb 22 14:38 demo
drwxr-xr-x 2 root root  4096 Jul 25  2012 Desktop
-rw-r--r-- 1 root root 36008 Jul 25  2012 install.log
-rw-r--r-- 1 root root  4939 Jul 25  2012 install.log.syslog
drwxr-xr-x 2 root root  4096 Feb 22 15:15 jms
-rw------- 1 root root 46033 Oct 29 10:00 mbox

要显示秒(实际更精确),可以用 –full-time 参数:
-rw------- 1 root root  1463 2012-07-25 12:56:42.000000000 +0800 anaconda-ks.cfg
-rw-r--r-- 1 root root    11 2013-02-22 14:38:56.000000000 +0800 demo
drwxr-xr-x 2 root root  4096 2012-07-25 21:17:04.000000000 +0800 Desktop
-rw-r--r-- 1 root root 36008 2012-07-25 12:56:31.000000000 +0800 install.log
-rw-r--r-- 1 root root  4939 2012-07-25 12:53:11.000000000 +0800 install.log.syslog
drwxr-xr-x 2 root root  4096 2013-02-22 15:15:24.000000000 +0800 jms
-rw------- 1 root root 46033 2012-10-29 10:00:29.000000000 +0800 mbox

要显示更多信息,用 stat 命令
#stat jms
  File: `jms'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: fd00h/64768d    Inode: 16253060    Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-02-22 15:15:24.000000000 +0800
Modify: 2013-02-22 15:15:24.000000000 +0800
Change: 2013-02-22 15:15:24.000000000 +0800