Linux中touch file
时间: 2024-01-22 08:19:50 浏览: 167
在Linux中,touch是一个命令行工具,用于创建一个空文件或者更改已有文件的访问和修改时间。如果文件不存在,则touch命令会创建该文件。如果文件已经存在,则touch命令会更新文件的访问和修改时间戳,但是文件的内容不会被修改。
要使用touch命令创建一个空文件,只需在命令行中输入:
```
touch filename
```
其中,filename是你想要创建的文件名。如果该文件已经存在,则touch命令会更新该文件的访问和修改时间戳。
如果你想要更改一个已存在文件的访问和修改时间戳,也可以使用touch命令。只需在命令行中输入:
```
touch -c filename
```
其中,-c选项表示如果该文件不存在,则不创建文件。如果该文件已经存在,则touch命令会更新该文件的访问和修改时间戳。
此外,还可以使用touch命令同时创建多个文件,只需在命令行中输入多个文件名,用空格隔开,例如:
```
touch file1 file2 file3
```
这将会创建file1、file2、file3三个空文件。
相关问题
Linux中touch 、home/mzr/tep/file1 file2
这不是一个完整的命令,应该是两个命令:
1. `touch`:用于创建一个空的文件,或者修改一个已存在的文件的时间戳。
示例:`touch file1`
这个命令会在当前目录下创建一个名为 `file1` 的空文件。
2. `home/mzr/tep/file1 file2`:这个不是命令,看起来像是想表达的路径。
如果你是想在 `/home/mzr/tep/` 目录下创建两个文件 `file1` 和 `file2`,应该使用以下两个命令:
示例:
```
cd /home/mzr/tep/
touch file1 file2
```
第一行切换到 `/home/mzr/tep/` 目录,第二行创建了两个空文件 `file1` 和 `file2`。
linux中touch
touch是一个Linux命令,用于创建一个新的空文件或者修改已有文件的时间戳。当你使用touch命令时,如果指定的文件已经存在,那么它将会被更新到当前时间;如果该文件不存在,那么touch命令会创建一个新的空文件并将其时间戳设置为当前时间。touch命令的基本语法如下:
```
touch [OPTION]... FILE...
```
其中,OPTION是可选参数,FILE是要创建或修改时间戳的文件名。例如:
```
touch file.txt
```
这个命令将创建一个名为file.txt的空文件,或者如果该文件已经存在,那么它将更新该文件的时间戳。
阅读全文
相关推荐













