LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Touch can't change access time (https://www.linuxquestions.org/questions/linux-software-2/touch-cant-change-access-time-447296/)

activeco 05-22-2006 04:35 AM

Touch can't change access time
 
Actually it does, but not to the time specified.

I wanted to change access time of a file with the command:

touch -a -t 0505051559 filename

however the result returned with 'ls -cl' is always the (current) time of the last touch command.

What do I miss?

jschiwal 05-22-2006 06:37 AM

To list the access time, use "ls -l --time=atime".
Code:

$ echo :>sample
$ ls -l sample
-rwxr-xr-x 1 schiwalj mkpasswd 2 May 22 06:38 sample
$ touch -a -t 0505051559 sample
$ ls -l --time=atime sample
-rwxr-xr-x 1 schiwalj mkpasswd 2 May  5  2005 sample


activeco 05-22-2006 06:51 AM

Quote:

Originally Posted by jschiwal
To list the access time, use "ls -l --time=atime".

Indeed.
Now I understand what they mean with "--time=WORD" from 'man ls'.

Thanks a lot jschiwal.


All times are GMT -5. The time now is 02:38 PM.