linux命令详解:touch
说明
修改文件、目录的时间属性,无则新建文件
语法
touch [option] <文件/目录>
option
| 常用参数 | 作用 |
|---|---|
| -a | 修改文件访问时间为当前时间 |
| -m | 修改文件修改时间为当前时间 |
| -c | 禁止新建文件 |
| -r <文件/目录> | 使用参考档的时间记录 |
| -d <日期时间> | 设置时间与日期 |
| -t <日期时间> | 设置文件的时间记录 |
文件/目录
支持同时设置多文件、目录
touch a.txt b.txt # 同时创建a.txt和b.txt
touch -m a.txt b.txt # 同时修改a.txt和b.txt的修改时间

浙公网安备 33010602011771号