2014-02-10 16:35:16 -08:00
|
|
|
# touch
|
|
|
|
|
2022-12-15 22:28:53 +10:00
|
|
|
> Create files and set access/modification times.
|
2024-09-09 17:11:41 +02:00
|
|
|
> More information: <https://manned.org/touch>.
|
2014-02-10 16:35:16 -08:00
|
|
|
|
2022-12-15 22:28:53 +10:00
|
|
|
- Create specific files:
|
2014-02-10 16:35:16 -08:00
|
|
|
|
2022-12-15 22:28:53 +10:00
|
|
|
`touch {{path/to/file1 path/to/file2 ...}}`
|
2014-02-10 16:35:16 -08:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
- Set the file [a]ccess or [m]odification times to the current one and don't create file if it doesn't exist:
|
2014-02-10 16:35:16 -08:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`touch {{[-c|--no-create]}} -{{a|m}} {{path/to/file1 path/to/file2 ...}}`
|
2021-10-29 13:43:29 -04:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
- Set the file [t]ime to a specific value and don't create file if it doesn't exist:
|
2021-10-29 13:43:29 -04:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`touch {{[-c|--no-create]}} -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}`
|
2014-02-10 16:35:16 -08:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
- Set the files' timestamp to the reference file's timestamp, and do not create the file if it does not exist:
|
2014-02-10 16:35:16 -08:00
|
|
|
|
2025-03-12 21:05:58 +02:00
|
|
|
`touch {{[-c|--no-create]}} {{[-r|--reference]}} {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}`
|