How can the 'touch' command be used?

QuestionsQuestions8 SkillsProPermissions of FilesAug, 05 2025
0156

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

  1. Open a terminal.

  2. Run the command to create a file:

    touch example.txt
  3. 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.

0 Comments

no data
Be the first to share your comment!