码迷,mamicode.com
首页 > 其他好文 > 详细

touch

时间:2019-01-30 17:20:24      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:更新   建立   兼容   时间戳   creat   简单   包括   use   忽略   

1、命令格式:
  touch [选项] 文件

2、命令功能:
  touch命令参数可更改文档或目录的日期时间,包括存取时间和更改时间。

3、命令参数:
  -a 或--time=atime或--time=access或--time=use  只更改存取时间。
  -c 或--no-create  不建立任何文档。
  -d  使用指定的日期时间,而非现在的时间。
  -f  此参数将忽略不予处理,仅负责解决BSD版本touch指令的兼容性问题。
  -m 或--time=mtime或--time=modify  只更改变动时间。
  -r  把指定文档或目录的日期时间,统统设成和参考文档或目录的日期时间相同。
  -t  使用指定的日期时间,而非现在的时间。

4、简单实例:
  (1)创建不存在的文件
    [root@localhost shiyan]# touch abc
    [root@localhost shiyan]# ls
    abc

  (2)更新b.txt的时间和a.txt的时间戳相同
    touch -r a.txt b.txt

  (3)设定文件的时间戳
    touch -t 201811120204 b.txt

  (4)创建多个文件
    [root@localhost shiyan]# touch {1..5}.txt
    [root@localhost shiyan]# ls
    1.txt 2.txt 3.txt 4.txt 5.txt abc
    [root@localhost shiyan]#

touch

标签:更新   建立   兼容   时间戳   creat   简单   包括   use   忽略   

原文地址:https://www.cnblogs.com/Devil_hk/p/10338622.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!