touch(1) - change file access and modification times
Before I demonstrate the touch command, let's identify what is my User ID, 'UID' and Group ID, 'GID'.
uid=101(wahid) gid=10(staff) groups=10(staff)
Here I am running the command below to verify that I am logged in as 'wahid'.
wahid
Then, I run the command below to find out the terinal (TTY), and the date and time I have logged in.
wahid pts/3 2011-01-09 17:44 (:0.0)
In the next two commands I am in the 'Test' directory and create an empty file 'newfile' with the timestamp of the current date and time of the system.
/export/home/wahid/Public/Test
I verify that the 'newfile' was zero byte in size and has the current system timestamp as it's creating date and time.
-rw-r--r-- 1 wahid staff 0 2011-01-09 17:55 newfile
Using the '-t TIMESTAMP' option of the touch command, I change the timestamp of the file to 12:00
noon of January 1st, 2011.
I verify the change as shown below:
-rw-r--r-- 1 wahid staff 0 2011-01-01 12:00 newfile
Now, I run the command 'date' to show today's date and time.
Sun Jan 9 17:56:10 PST 2011
Here, I change the timestamp of the 'ne wfile' to the current date and time timestamp.
I verfiy again the change and know the touch command worked as it was expected.
-rw-r--r-- 1 wahid staff 0 2011-01-09 17:56 newfile
Please click on " man touch " to see the Manual Page for this command.