touch - change file timestamps
来源:百度文库 编辑:神马文学网 时间:2024/06/28 09:54:01
NAME
touch - change file timestampsSYNOPSIS
touch[OPTION]... FILE...DESCRIPTION
Update the access and modification times of each FILE to the current time.
Mandatory arguments to long options are mandatory for short options too.
/////文件的时间属性:modification time (mtime),随文件的内容改变而改变.status time(stime)文件权限、属性..access time(atime)读取文件内容时
- -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
- set time given by WORD: access atime use (same as -a)modify mtime (same as -m)
- --help
- display this help and exit
- --version
- output version information and exit
Note that the -d and -t options accept different time-date formats.
AUTHOR
Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith.REPORTING BUGS
Report bugs toCOPYRIGHT
Copyright © 2004 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
The full documentation fortouchis maintained as a Texinfo manual. If theinfoandtouchprograms are properly installed at your site, the command- info coreutils touch
should give you access to the complete manual.
****************eg**************
[test@zao2 tmp]$ cp -a ~/.bashrc bashrc
[test@zao2 tmp]$ ll bashrc;ll --time=ctime bashrc;ll --time=atime bashrc
-rw-r--r--. 1 test test 124 2009-09-16 18:15 bashrc
-rw-r--r--. 1 test test 124 2010-09-23 15:22 bashrc
-rw-r--r--. 1 test test 124 2010-09-22 16:44 bashrc
[test@zao2 tmp]$ touch -d 100909 bashrc ///时间改为20100909
[test@zao2 tmp]$ ll bashrc;ll --time=ctime bashrc;ll --time=atime bashrc
-rw-r--r--. 1 test test 124 2010-09-09 00:00 bashrc
-rw-r--r--. 1 test test 124 2010-09-23 15:23 bashrc
-rw-r--r--. 1 test test 124 2010-09-09 00:00 bashrc