linux命令touch介绍(7)

    Read

touch是一个建立文件,更改文件atime、ctime、mtime的命令
参数:

-a:修改文件的atime,文件可以不存在
-c:不建立任何文件
-d:修改文件的当前时间,文件可以不存在
-h:主要用于更改软链接的时间戳,文件必须存在
-m:更改时间的mtime,文件可以不存在
-r:将文件修改为当前时间
-t:用[[CC]YY]MMDDhhmm[.ss]替代文件的当前时间
--time=WORD:等效于-m参数 SourceByrd's Weblog-https://note.t4x.org/rebuilding/touch-command-description/

案例:

SourceByrd's Weblog-https://note.t4x.org/rebuilding/touch-command-description/

atime:Access time,是在读取文件或者执行文件时更改,即文件最后一次被读取的时间。
说明: st_atime
Time when file data was last accessed. Changed by the
following functions: creat(), mknod(), pipe(),
utime(2), and read(2).SourceByrd's Weblog-https://note.t4x.org/rebuilding/touch-command-description/

mtime:Modified time,是在写入文件时随文件内容的更改而更改,是指文件内容最后一次被修改的时间。
说明: st_mtime
Time when data was last modified. Changed by the fol-
lowing functions: creat(), mknod(), pipe(), utime(),
and write(2).SourceByrd's Weblog-https://note.t4x.org/rebuilding/touch-command-description/

ctime:Change time,是在写入文件、更改所有者、权限或链接设置时随 Inode 的内容更改而更改,即文件状态最后一次被改变的时间。
说明: st_ctime
Time when file status was last changed. Changed by the
following functions: chmod(), chown(), creat(),
link(2), mknod(), pipe(), unlink(2), utime(), and
write(). SourceByrd's Weblog-https://note.t4x.org/rebuilding/touch-command-description/

SourceByrd's Weblog-https://note.t4x.org/rebuilding/touch-command-description/SourceByrd's Weblog-https://note.t4x.org/rebuilding/touch-command-description/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!
Byrd
  • by Published on December 14, 2017
  • 原文链接:https://note.t4x.org/rebuilding/touch-command-description/
匿名

Comment

Anonymous

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: