Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am running some simulation on a high performance computing cluster (HPC). When I check when the file was changed with ls -t I get the wrong result. I know this becouse I have run a small job that print a different file from the one that was pressent during when the server claims it was last changed.

Is there any other way?

Thanks

Example:

ls -lut
total 328
-rw-r--r-- 1 avityo ofarago  89070 Nov 23 21:17 mem.xyz
-rwxr-xr-x 1 avityo ofarago 218752 Nov 23 21:17 mem
-rw-r--r-- 1 avityo ofarago    404 Nov 23 21:17 propFile.dat
-rw-r--r-- 1 avityo ofarago    271 Nov 23 14:01 parOut.txt

after I run cat parOut.txt (which is the main file that I follow):

ls -lut
total 328
-rw-r--r-- 1 avityo ofarago    271 Nov 24 11:47 parOut.txt
-rw-r--r-- 1 avityo ofarago  89070 Nov 23 21:17 mem.xyz
-rwxr-xr-x 1 avityo ofarago 218752 Nov 23 21:17 mem
-rw-r--r-- 1 avityo ofarago    404 Nov 23 21:17 propFile.dat

The files themself are stored on some sort of central file system server that I don't know anything about

share|improve this question
10  
I cannot understand how does it works the test you use to say that ls is wrong. Can you explain better, please? –  enzotib Nov 24 '11 at 7:53
    
Could you show output of both ls -t and ls -al –  bbaja42 Nov 24 '11 at 8:21
    
Where do you store the file and from where do you check the file? Please be more precise and explain exactly what you do. –  ddeimeke Nov 24 '11 at 8:21
    
Use ls -l and check the file times manually. –  amphetamachine Nov 24 '11 at 8:45
4  
You are using -u option, that in combination with -lt shows and sorts by access time, not modification time as you ask. –  enzotib Nov 24 '11 at 10:51
show 1 more comment

1 Answer 1

Enzotib provided the correct answer in the comments on your original question. However there are still potential issues. You said the files are being stored on a remote file system. Most remote filesystems will use the time of the file server itself for the ctime, mtime, and atime attributes. Thus if the time of your file server is off, the times on the files will not be accurate.

share|improve this answer
    
I don't know if that's relevant or not but the date command provides the right time. –  Yotam Nov 24 '11 at 20:33
    
@Yotam: That's only half the story. You've confirmed that the clock on your local system is set correctly, but not that the clock in the server is set correctly. To test that, try something like this: date ; touch /some/new/file/on/server ; ls -l /some/new/file/on/server ; date. See if the output is consistent. (Creating and listing the file might take some time; the two date commands give you a possible range of correct times). –  Keith Thompson Nov 24 '11 at 22:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.