Linux touch command

Linux touch command

 Linux touch command


The Linux touch command is used to create empty files or change the time stamp for existing files.

Syntax:

$ touch 

Example:

For this example, first, check the number of files available in the current directory. I have one file in our directory as below

$ ls -l

-rw-r--r--  1 root  root   656 Dec 28  2015 testfile.doc

Check the modification date of the existing file and create a new file myfile.txt using the touch command. Also, try the touch command with the existing file.

$ touch myfile.txt
$ touch testfile.doc

Again list the files in the current directory. You can see a new empty file created and the existing file modification time is changed to the current date/time.

$ ls -l

-rw-r--r-- 1 root root    0 Sep  5 14:37 myfile.txt
-rwxr-xr-x 1 root root  104 Sep  5 14:38 testfile.doc
Souy Soeng

Souy Soeng

Our website teaches and reads PHP, Framework Laravel, and how to download Admin template sample source code free. Thank you for being so supportive!

Github

Post a Comment

CAN FEEDBACK
close