Chinaunix首页 | 论坛 | 博客
  • 博客访问: 168602
  • 博文数量: 39
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 214
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-21 11:10
文章分类

全部博文(39)

文章存档

2017年(6)

2016年(1)

2015年(6)

2014年(26)

我的朋友

分类: LINUX

2014-04-25 11:03:53

问题原型:编译openssl库的时候,遇到两个文件比较时间的问题:
openssl-1.0.1g# make
Makefile is older than Makefile.org, Configure or config.
Reconfigure the source tree (via './config' or 'perl Configure'), please.
make: *** [Makefile] Error 1
然后就在想,如何修改时间呢?当然,正常途径是按照提示,运行一下./config 或者 perl Configure 来解决上面的问题。
1. stat 命令来查看文件的时间
openssl-1.0.1g# stat Makefile
  File: `Makefile'
  Size: 25628           Blocks: 56         IO Block: 4096   regular file
Device: 811h/2065d      Inode: 12658229    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-04-24 10:48:12.314102767 +0800
Modify: 2014-04-22 14:14:14.0?00000000 +0800
Change: 2014-04-23 15:47:05.238352502 +0800
上面存在三个时间:
modification time(mtime,修改时间):当该文件的“内容数据”更改时,就会更新这个时间。内容数据指的是文件的内容,而不是文件的属性。
status time(ctime,状态时间):当该文件的”状态(status)”改变时,就会更新这个时间,举例来说,更改了权限与属性,就会更新这个时间。
access time(atime,存取时间):当“取用文件内容”时,就会更新这个读取时间。举例来说,使用cat去读取 ~/.bashrc,就会更新atime了。
2.touch命令来修改修改时间和存取时间:
openssl-1.0.1g# touch --help
Usage: touch [OPTION]... FILE...
Update the access and modification times of each FILE to the current time.


Mandatory arguments to long options are mandatory for short options too.
  -a                     change only the access time        #只是改变存取时间
  -c, --no-create        do not create any files            #不创建任何文件
  -d, --date=STRING      parse STRING and use it instead of current time    #使用指定时间而不是系统当前时间,改变的是‘存取时间和修改时间’
  -f                     (ignored)
  -m                     change only the modification time            #只改变修改时间
  -r, --reference=FILE   use this file's times instead of current time        #使用这个文件的时间
  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time
  --time=WORD            change the specified time:
                           WORD is access, atime, or use: equivalent to -a
                           WORD is modify or mtime: equivalent to -m




openssl-1.0.1g#?? touch -d "2000-02-04 11:00:23" Makefile        #加上-d 选项后,不适用当前时间,使用指定的时间来修改存取时间、修改时间
openssl-1.0.1g#
openssl-1.0.1g# stat Makefile
  File: `Makefile'
  Size: 25628           Blocks: 56         IO Block: 4096   regular file
Device: 811h/2065d      Inode: 12658229    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2000-02-04 11:00:23.000000000 +0800
Modify: 2000-02-04 11:00:23.000000000 +0800
Change: 2014-04-25 10:57:06.470103318 +0800
openssl-1.0.1g# touch Makefile                            #不加任何参数就会变成当前的时间
openssl-1.0.1g# stat Makefile
  File: `Makefile'
  Size: 25628           Blocks: 56         IO Block: 4096   regular file
Device: 811h/2065d      Inode: 12658229    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-04-25 10:57:47.882103296 +0800
Modify: 2014-04-25 10:57:47.882103296 +0800
Change: 2014-04-25 10:57:47.882103296 +0800








阅读(4637) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~