The touch command is used to create a new empty file or update the timestamp of an existing file.

Examples:

  • To create a new empty file:
touch newfile.txt
  • To update the timestamp of an existing file (useful for updating access or modification time without changing the content):
touch existingfile.txt
  • Important Points:
    • If the file specified in the touch command does not exist, it will be created as an empty file.
    • If the file already exists, touch will update the file’s access and modification time to the current time.