Touch command is one of the basic commands in Linux/UNIX flavor machines for working with files.
To create empty files in a directory.
To update the timestamp of the file without changing the content.
Creation of empty file:
Command example output:
If you observe that created file size is “0”. i.e, nothing is there in the file.
Updating the modified time of the file:
If the file is already created then with touch command, its modified time is updated.
Sometimes, an automated script missed a file to consider, then we want to modify the file timestamp for getting picked up by script.
Creating multiple empty files with touch command:
With touch command, we can create multiple files at a time in directory.
Why we need multiple empty files? Any business case here?
Practical usage example…
Command Example Output:
Listing the files: