Linux touch & >命令


Linux touch & >命令
 
touch 命令有两个作用
 
1. 刷新文件或者目录的最后一次修改的时间和访问时间为现在的时间  ( 现在存在的文件或目录)
  www.2cto.com  
2. 建立文件
 
touch [-option] 文件
 
touch /tmp/test
 
-a   只改变访问时间
 
-c   不新建任何文件
 
-f   忽略
 
-m  只改变修改时间  www.2cto.com  
 
-r   将文件的时间替代现有的时间       ps :  touch -r /tmp/test1 /tmp/test2      将test2的时间改的和test1一样
 
-t   使用具体的年月日时间来更改      
 
      touch -t  YYYYMMDDhhmm
 
      touch -t  MMDDhhmm     
 
      可配合使用 -a & -m
 
      ps:  touch -t  201302211009.02 /tmp/test2
 
             touch -t  02211109
 
 >  也可以建立文件,比touch更短
 
> /tmp/test
 

相关内容

    暂无相关文章