1. Home
  2. Linux
  3. Linux Files
  4. Linux – touch

Linux – touch

Linux touch command

Linux touch command is used to create empty files or change 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 existing file and create a new file myfile.txt using touch command. Also, try touch command with the existing file.

$ touch myfile.txt
$ touch testfile.doc

Again list the files in current directory. You can see a new empty file created and existing file modification time is changed to 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
Was this article helpful to you? Yes 3 No
Advertisement