2020-06-28 04:22:26 +02:00
|
|
|
# touch
|
|
|
|
|
2020-08-22 02:08:30 +02:00
|
|
|
Create one or more files in the current or an already existent directory.
|
2020-06-28 04:22:26 +02:00
|
|
|
It has no effect on existing files.
|
|
|
|
Unlike GNU touch, the access time and the modified time are not updated.
|
|
|
|
|
|
|
|
`-h`, `--help`
|
|
|
|
Display help message.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Create a file in an empty folder. Then touch the file and list files again to observe that the modified time has not been updated.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
> ls
|
|
|
|
> touch file.ext; ls
|
|
|
|
──────────┬─────────────
|
|
|
|
name │ file.ext
|
|
|
|
type │ File
|
|
|
|
size │ 0 B
|
|
|
|
modified │ 0 secs ago
|
|
|
|
──────────┴─────────────
|
|
|
|
> touch file.ext; ls
|
|
|
|
──────────┬───────────
|
|
|
|
name │ file.ext
|
|
|
|
type │ File
|
|
|
|
size │ 0 B
|
|
|
|
modified │ 10 secs ago
|
|
|
|
──────────┴───────────
|
|
|
|
```
|
|
|
|
|
|
|
|
Create a file within an already existent folder.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
> mkdir dir
|
|
|
|
> touch dir/file.ext; ls dir
|
|
|
|
──────────┬───────────
|
|
|
|
name │ dir/file.ext
|
|
|
|
type │ File
|
|
|
|
size │ 0 B
|
|
|
|
modified │ 0 secs ago
|
|
|
|
──────────┴───────────
|
|
|
|
```
|
2020-08-22 02:08:30 +02:00
|
|
|
|
2021-01-02 05:24:32 +01:00
|
|
|
Create three files at once
|
2020-08-22 02:08:30 +02:00
|
|
|
```shell
|
|
|
|
> touch a b c
|
|
|
|
> ls
|
|
|
|
────┬────────────────────┬──────┬──────────┬──────────────
|
|
|
|
# │ name │ type │ size │ modified
|
|
|
|
────┼────────────────────┼──────┼──────────┼──────────────
|
|
|
|
0 │ a │ File │ 0 B │ 0 sec ago
|
|
|
|
1 │ b │ File │ 0 B │ 0 sec ago
|
|
|
|
2 │ c │ File │ 0 B │ 0 sec ago
|
2021-01-02 05:24:32 +01:00
|
|
|
────┴────────────────────┴──────┴──────────┴──────────────
|