Linux Touch

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Linux touch command

touch command is a way to create empty files (there are some other mehtods also). You can update the modification and access time of each file with the help of touch command.

Syntax:

touch <filename> 

Example:

touch myfile1

TOUCH Command

Look above, we have created two files namely 'myfile1' and 'myfile2' through touch command. To create multiple files just type all the file names with a single touch command followed by enter key. For example, if you would like to create 'myfile1' and 'myfile2' simultaneously, then your command will be:

  1. touch myfile1 myfile2  

touch Options

Option Function
touch -a To change file access and modification time.
touch -m It is used to only modify time of a file.
touch -r To update time of one file with reference to the other file.
touch -t To create a file by specifying the time.
touch -c It does't create n empty file.