The touch command is used in Linux to create an empty file or update the timestamp of an existing file. Here’s how you can use it:
Creating a New File
To create a new empty file named example.txt, you can run:
touch example.txt
Updating an Existing File
If example.txt already exists, running the same command will update its last modified timestamp without changing its content.
Example Usage
-
Open a terminal.
-
Run the command to create a file:
touch example.txt -
You can verify that the file was created by listing the files in the directory:
ls -l
This will show example.txt in the list of files.
