zoukankan      html  css  js  c++  java
  • touch命令详解

    一、用法

    touch命令主要有两个功能:

    • 将已存在文件的时间更改为当前系统时间
    • 创建一个空的文件

    常见参数详解:

    -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)
    
    -h, --no-dereference
           affect  each symbolic link instead of any referenced file (useful only
           on systems that can change the timestamps of a symlink)
    
    -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
          change the specified time: WORD is access, atime, or  use:  equivalent
          to -a WORD is modify or mtime: equivalent to -m

    二、实战

    #创建一个不存在的空文件,如果存在无影响
    [root@localhost project]# touch t1.txt
    
    # 改变文件的时间戳
    [root@localhost project]# touch -t 202010091130 t1.txt 
    [root@localhost project]# ll
    -rw-r--r--. 1 root root 4 Oct  9 11:30 t1.txt
  • 相关阅读:
    监听刷新
    判断当前日期是否在[startDate, endDate]区间
    精确计算工具类,提供加减乘除的计算
    常用正则表达式
    高并发
    递归案例
    序列化和反序列化
    web安全
    复杂跨域之CorsFilter源码分析
    springMVC访问根路径问题
  • 原文地址:https://www.cnblogs.com/shenjianping/p/13782224.html
Copyright © 2011-2022 走看看