Thursday, 17 December 2015

Basics of TOUCH Command

Touch is a standard Unix command which is used to update the access/modification date of a file or directory.

How to create a ZERO byte file.

$ touch abc.txt

Touch doesn't modify the contents of abc.txt; It just updates the time stamp of the file to the system current date and time.

How to create multiple ZERO byte files

$ touch abc.txt pqr.txt xyz.txt

Create a file when it is not available

$ touch -c abc.txt

How to create a file with the same time stamp of other file.

$ touch -r abc.txt pqr.txt
$ touch a.txt -r pqr.txt

It will create file pqr.txt which will have same time stamp as of abc.txt.

How to change/update the date and time of a file

$ touch -t 200908230740.20 abc.txt

It will update the time stamp of the file abc.txt to 23-08-2009 07:40:20.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...