您的位置:首页 > 运维架构 > Linux

linux 文件的atime,ctime,mtime查看与修改

2013-10-25 13:19 453 查看
查看

ls -a默认显示的是修改时间

ls -c / --time=status / --time=ctime显示的是状态修改时间(即权限修改时间)

ls -u / --time=use / --time=access / --time=atime表示的是文件访问时间

修改

touch: 缺少了文件操作数

请尝试执行“touch --help”来获取更多信息。

[wei@localhost ~]$ touch --help

用法:touch [选项]... 文件...

将每个<文件>的访问及修改时间都更新为目前时间。

长选项必须用的参数在使用短选项时也是必须的。

  -a                     只更改访问时间

  -c, --no-create        不创建任何文件

  -d, --date=字符串        使用<字符串>表示的时间而不是目前的时间

  -f                     (此选项不作处理)

  -m                     只更改修改时间

  -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

      --help     显示此帮助信息并退出

      --version  输出版本信息并退出

Note that the -d and -t options accept different time-date formats.

 

-d <时间日期字符串>  或 --date=<时间日期字符串> 使用指定的字符串日期时间,而非系统当前时间,日期字符包括月份,时区,上午(am),下午(pm)等。如:--date="2010-08-08 2:30pm"或
--date="2010-08-08 14:30"

-t <时间戳> 使用指定的日期时间,而非当前时间来更改文件的时间属性。

时间戳的格式:ccyymmddhhmm.SS

分表表示:

cc 年份头两位

yy 年份后两位

mm 月(01-12)

dd 天(01-31)

hh 小时(00-23)

mm 分钟(00-59)

SS 秒 (00-59)

 

例一:修改时间为2天之前

touch -d '2 days ago' telnet目录/

例二:touch -t 200303031536 mm

[wei@localhost telnet目录]$ ll

总计 4

-rw-rw-r-- 1 boco boco 0 10-25 13:12 mm

[wei@localhost telnet目录]$ touch -t 200303031536 mm
[boco@localhost telnet目录]$ ll

总计 4

-rw-rw-r-- 1 boco boco 0 2003-03-03 mm

[wei@localhost telnet目录]$
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  atime ctime mtime 查看 修改