touch Command in Linux

In this blog we will learn about touch command . touch command is the easiest way to create new empty files in Linux .It is also used to change the time stamps on existing files or directories . First of all lets open our terminal , We can press ctrl+alt+ t to do this .

1.Now , we want to create a new empty file .We can use a touch command toc reate a new empty file and to create a new empty file we just need to write touch which is a command and then there can be options for touch but the simplest way is to give the name of the file .Basic command looks like : $touch file_name . We cannot create a directory using a touch command you can only create a empty .


We can even give the extension of the file for example file3.txt or file3.cpp or any other extension and it will create it .

2 . If you use the touch command on this file which already exists it’s going to update the timestamp of the file to the current timestamp . The command looks similar to previous one : $touch file_name .

So these are the two basic uses of touch command first is to create empty files and second is to update the timestamp of a given file .

Partner Sites

Be the first to comment

Leave a Reply

Your email address will not be published.