Touch Command in Linux with Examples
# The touch Command in Linux
The `touch` command is a Unix and Linux command line utility used to create, change, and modify timestamps of a file. It is one of the most commonly used commands in the Linux terminal and is extremely useful for maintaining a system's files. This command can be used to create empty files, modify timestamps of existing files, and change the access and modification times of a file.
The `touch` command is particularly useful when creating a new file that needs to be referenced by other commands. It is also useful when editing configuration files. By changing the timestamps of a file, users can indicate that the contents of the file have been modified, even if the actual contents have not changed.
The `touch` command is a versatile tool that can be used for a variety of purposes. In this article, we will discuss the basics of the `touch` command and provide some examples to demonstrate its use.
Worried About Failing Tech Interviews?
Attend our webinar on
"How to nail your next tech interview" and learn
Founder, Interview Kickstart
Our tried & tested strategy for cracking interviews
How FAANG hiring process works
The 4 areas you must prepare for
Register for Webinar
How you can accelerate your learnings
**Touch command in Linux**
The touch command in Linux is a command line utility used to create, change, and modify timestamps of files and directories. It is commonly used to create empty files, update the access and modification times of files, and to create multiple files at once.
`touch [OPTION]... FILE...`
-a : Change access time only
-c : Don't create files
-m : Change modification time only
-t : Specify specific timestamp
1. Create an empty file:
2. Update the access and modification dates of a file:
`touch -a -m FileName.txt`
3. Create multiple files at once:
`touch FileName1.txt FileName2.txt FileName3.txt`
4. Specify a specific timestamp for a file:
`touch -t 202001011234 FileName.txt`