12 | touch command

Linux Command Line Tutorial

In this video, we will learn how to use touch command. The main purpose of this command is to change file access and modification time but it can be used to create a new file. In simple terms, it is used to change the timestamp of a given file.

touch can create a new file too. I find it much simpler to create a new file using touch. It is possible to create a file with any file extension. Moreover, you can create multiple files with just one command.

Remember you can always type man touch to learn more about the command.

We will also learn about some flags along with touch command:

-t = pass in custom timestamp
-a = just change access timestamp
-m = just change the modified timestamp
-r = copy timestamp from another file

Thank You!