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
Reactions

Post a Comment

0 Comments

close