2025-03-14 21:59:59 -06:00
|
|
|
# touch
|
|
|
|
|
|
|
|
|
|
> Create files and set access/modification times.
|
|
|
|
|
> More information: <https://manned.org/touch>.
|
|
|
|
|
|
|
|
|
|
- Create specific files:
|
|
|
|
|
|
|
|
|
|
`touch {{path/to/file1 path/to/file2 ...}}`
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
- Set the file [a]ccess or [m]odification times to the current one and don't create file if it doesn't exist:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`touch {{[-c|--no-create]}} -{{a|m}} {{path/to/file1 path/to/file2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
- Set the file [t]ime to a specific value and don't create file if it doesn't exist:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`touch {{[-c|--no-create]}} -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
- Set the files' timestamp to the reference file's timestamp, and do not create the file if it does not exist:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`touch {{[-c|--no-create]}} {{[-r|--reference]}} {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}`
|
2025-07-24 22:27:13 -06:00
|
|
|
|
|
|
|
|
- Set the timestamp by parsing a string:
|
|
|
|
|
|
|
|
|
|
`touch {{[-d|--date]}} "{{last year|5 hours|next thursday|nov 14|...}}" {{path/to/file}}`
|