O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

touch

Format:

touch options filename 

Option:

-t MMDDhhmm Create a file with a month, day, hour, minute, date stamp

This creates a file with a current or new date stamp.

					$ touch myfile 
$ ls -l myfile 
-rw-r--r-- 1 dave    admin            0 Jun 30 09:59 myfile
				

The above creates a new empty file with today’s date/time called myfile.

					$ touch -t 06100930 myfile2 
$ ls -l myfile2 
-rw-r--r-- 1 dave       admin            0 Jun 10 09:30 myfile2
				

The above creates a new empty file called myfile2 with the date stamp of June 10 at 09:30am.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required