1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/touch.md

21 lines
765 B
Markdown
Raw Normal View History

# touch
> Create files and set access/modification times.
2024-09-09 17:11:41 +02:00
> More information: <https://manned.org/touch>.
- Create specific files:
`touch {{path/to/file1 path/to/file2 ...}}`
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:
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 ...}}`
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:
2025-03-12 21:05:58 +02:00
`touch {{[-c|--no-create]}} {{[-r|--reference]}} {{path/to/reference_file}} {{path/to/file1 path/to/file2 ...}}`