Linux命令(8):touch
来源:互联网 发布:c语言中百分之f 编辑:程序博客网 时间:2024/05/16 23:45
touch 意为:摸一下。
个人理解是打探一下这个文件是否存在,如果存在,则修改该文件的最后访问时间;如果不存在,则创建这个文件;
命令格式:
touch + 文件名
命令参数:
-a 或–time=atime或–time=access或–time=use 只更改存取时间。
-c 或–no-create 不建立任何文档。
-d 使用指定的日期时间,而非现在的时间。
-f 此参数将忽略不予处理,仅负责解决BSD版本touch指令的兼容性问题。
-m 或–time=mtime或–time=modify 只更改变动时间。
-r 把指定文档或目录的日期时间,统统设成和参考文档或目录的日期时间相同。
- -t 使用指定的日期时间,而非现在的时间。
例1.修改已存在文件 mt1.txt 的访问时间
命令:touch mt1.txt 或者 touch -a mt1.txt
[mt555@localhost Desktop]$ ls # 桌面上有mt1.txt文件2 3 bin m1 m3 mt1.txt mt1.txt~ mt2.txt mt3.txt mt.py[mt555@localhost Desktop]$ touch mt1.txt # 修改mt1.txt文件的访问时间[mt555@localhost Desktop]$ ls2 3 bin m1 m3 mt1.txt mt1.txt~ mt2.txt mt3.txt mt.py
例2.创建不存在的文件
命令:touch mt4.xt
[mt555@localhost Desktop]$ ls #桌面上无mt4.txt这个文件2 3 bin m1 m3 mt1.txt mt1.txt~ mt2.txt mt3.txt mt.py[mt555@localhost Desktop]$ touch mt4.txt # 创建mt4.txt[mt555@localhost Desktop]$ ls #查看文件,发现已经有mt4.txt这个文件了2 3 bin m1 m3 mt1.txt mt1.txt~ mt2.txt mt3.txt mt4.txt mt.py[mt555@localhost Desktop]$
其他参数都差不多,这里就不一一举例了。
1 0
- Linux命令(8):touch
- linux命令-touch命令
- linux命令 -- touch 命令
- Linux命令:touch使用方法
- linux touch 命令详解
- Linux命令touch
- linux :touch 命令
- linux touch命令
- linux touch命令
- linux命令之--touch
- Linux touch命令
- Linux命令:touch
- linux touch 命令
- Linux命令:touch使用方法
- linux touch 命令
- Linux touch命令
- Linux命令touch
- Linux命令:touch
- Python for opencv 之 显示图像及在图像上书写文字
- CSU 1810 Reverse
- AngularJS的services服务及应用示例
- 关于LeetCode中Factorial Trailing Zeroes一题的理解
- 分治法求解切割篱笆
- Linux命令(8):touch
- iOS<Photos/Photos.h>与<AssetsLibrary/AssetsLibrary.h>and 相机
- 复杂链表的复制
- As抽风:Could not identify launch activity: Default Activity not found Error while Launching activity
- Web 前端概述
- CCF 201509-4 高速公路
- 黑马程序员前端培训:高效的前端编程入门训练方法
- Struts2 自定义结果类型
- 图——邻接表