LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 913|回复: 5

怎么知道最后访问的时间,精确到秒?

[复制链接]
发表于 2003-11-20 12:26:13 | 显示全部楼层 |阅读模式
我就看到-u了。
man ls|grep access
发表于 2003-11-20 16:27:44 | 显示全部楼层
unix time (file) has 3 notation:
atime: access time
mtime: last modified time
ctime: create time
兄弟们,是学基础的时候了!!!
 楼主| 发表于 2003-11-20 18:15:15 | 显示全部楼层
用ls -lTu 就行了。
发表于 2003-11-21 23:12:01 | 显示全部楼层
Here is a simple perl script by lawries
#!/usr/bin/perl -w ##############################################################################
#                                                                            #
# FILE NAME:            ftime                                                #
#                                                                            #
#----------------------------------------------------------------------------#
# PURPOSE: Retrive full set of file date                                     #
#                                                                            #
#----------------------------------------------------------------------------#
# usage:                                                                     #
#       List of files piped into ftime                                       #
#                                                                            #
# example:                                                                   #
#                                                                            #
#       ls -l | awk '{ print $9 }' | /usr/local/bin/ftime                    #
#                                                                            #
#----------------------------------------------------------------------------#
# REVISIONS:                                                                 #
#                                                                            #
# Lawrie  November 2003                   #
##############################################################################

use strict;
# use File::stat;

  while (<>) {

        chomp($_);
        my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime,
           $ctime, $blksize, $blocks) = stat($_);

        my $access = localtime $atime;
        my $modify = localtime $mtime;
        my $inodes = localtime $ctime;

        printf "$_ :  \n";
        printf "     Last Access Time : $access \n";
        printf "     Last Modify Time : $modify \n";
        printf "     Last Inode change: $inodes \n";

  }
 楼主| 发表于 2003-11-22 13:48:26 | 显示全部楼层
谢谢版主~~~~~~~~~~~~~~~~

FREE# perl full_time_free foo
Use of uninitialized value at full_time_free line 32, <> chunk 1.
Use of uninitialized value at full_time_free line 33, <> chunk 1.
Use of uninitialized value at full_time_free line 34, <> chunk 1.
#!/usr/bin/perl -w :
Last Access Time : Thu Jan  1 00:00:00 1970
Last Modify Time : Thu Jan  1 00:00:00 1970
Last Inode change: Thu Jan  1 00:00:00 1970
FREE#

上面的三行好象是出错信息哦。。。
发表于 2003-11-27 10:40:49 | 显示全部楼层
为了提高性能,atime很有可能不刷新
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表