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

25 lines
627 B
Markdown
Raw Normal View History

# touch
> Change a file access and modification times (atime, mtime).
> More information: <https://www.gnu.org/software/coreutils/touch>.
- Create a new empty file(s) or change the times for existing file(s) to current time:
2021-10-29 13:43:29 -04:00
`touch {{path/to/file}}`
- Set the times on a file to a specific date and time:
2021-10-29 13:43:29 -04:00
`touch -t {{YYYYMMDDHHMM.SS}} {{path/to/file}}`
- Set the time on a file to one hour in the past:
`touch -d "{{-1 hour}}" {{path/to/file}}`
- Use the times from a file to set the times on a second file:
2021-10-29 13:43:29 -04:00
`touch -r {{path/to/file1}} {{path/to/file2}}`
2021-05-14 03:40:50 +03:00
- Create multiple files:
2021-10-29 13:43:29 -04:00
`touch {{path/to/file{1,2,3}.txt}}`