- Published on
What is the 'touch' command in Terminal?
- Authors
- Name
- hwahyeon
The touch
command, available in UNIX, Linux, and macOS systems, creates a new file if one doesn’t exist or updates the modification timestamp of an existing file.
Note that it is not natively supported in Windows, but similar functionality can be achieved using PowerShell or other tools like Git Bash.
1. Create a file:
touch example.txt
2. Updates the modification time to the current time:
touch existing_file.txt
3. Creates multiple files at once:
touch file1.txt file2.txt
4. Set a specific timestamp:
touch -t 202301010101 example.txt
Sets the timestamp to January 1, 2023, at 01:01.