Command to find last time file was opened


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Command to find last time file was opened
# 1  
Old 07-17-2007
Command to find last time file was opened

New to unix .. Is there a simple command or utility that will tell me when the last time a file was opened/used?
# 2  
Old 07-17-2007
Yes. A file has three time stamps

Code:
              time_t    st_atime;   /* time of last access */
              time_t    st_mtime;   /* time of last modification */
              time_t    st_ctime;   /* time of last status change */

In Linux the program "stat" will let you see the different time stamps.

Also, with Linux the "ls" command has the following option

Code:
       --time=WORD
              with -l, show time as WORD instead of modification time:  atime,
              access,  use, ctime or status; use specified time as sort key if
              --sort=time

# 3  
Old 07-18-2007
one reminder

if the file system is mounted with no atime option for performance reasons, access time will not be updated then.
# 4  
Old 07-18-2007
Quote:
Originally Posted by matrixmadhan
one reminder

if the file system is mounted with no atime option for performance reasons, access time will not be updated then.
Or mounted readonly. Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Getting files through find command and listing file modification time upto seconds

I have to list the files of particular directory using file filter like find -name abc* something and if multiple file exist I also want time of each file up to seconds. Currently we are getting time up to minutes in AIX is there any way I can get file last modification time up to seconds. (4 Replies)
Discussion started by: Nitesh sahu
4 Replies

2. Solaris

Find command output gives one day before time stamp

Hi All, I am listing the files which are 4 hours older. For this first I have creted a dummy file with the 4 hours before timestamp, then I am using the below find command, find /path/ -type f ! -newer 4_hours_oledr_file -exec ls -lrt {} \; I am getting the files which are older than... (13 Replies)
Discussion started by: velava
13 Replies

3. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

4. Shell Programming and Scripting

Time Zone and find command

I need some help trying to figure this out. I have written a bash script that uses gnu find command every minute to check any incoming/outgoing files and then take appropriate action. Everything works fine if we are in the US time zone but as soon as China and Europe time-zone come in my script... (4 Replies)
Discussion started by: maunir
4 Replies

5. Shell Programming and Scripting

Help with cp command when destination file is opened

I am writing a shell script (runs on HP Unix) which copies files from a source directory to another destination daily. The destination directory always have the files with same name as in the source directory. And daily a new file will be created in the source. cp command works fine if the file... (1 Reply)
Discussion started by: arunkumar_ms
1 Replies

6. Shell Programming and Scripting

How to find who opened/modified a file last

Hi *, I'm wondering if it possible to know WHO opened or modified a file last? I know it's possible with some options of find and also ls to get when the file was modified last. I'm currently supervising a file and have to log all users name who opened or modified it. Thanx a lot for any... (3 Replies)
Discussion started by: Jabarod
3 Replies

7. Shell Programming and Scripting

Find process through file opened

Hello all, I have a file that is growing and growing by the action of any process. How can I find what process is? Thank you (2 Replies)
Discussion started by: albertogarcia
2 Replies

8. Shell Programming and Scripting

How to display what processes, users have opened at a given time

Hello, What i have to do is make a top 10 list of users sorted by the number of processes opened at a given time. Can anyone help me with finding out for a given moment, for all users how many processes each had opened? (5 Replies)
Discussion started by: gabibyte
5 Replies

9. UNIX for Advanced & Expert Users

To find the time of excution of a particular unix command

Hi experts, It would be grateful if you can guide me on the following, 1.How to find the time of excution of a particular unix command. 2. How to find the terminal (IP Address) from where that particular unix command was excuted. 3. How to find the user who executed that particular unix... (1 Reply)
Discussion started by: apsprabhu
1 Replies

10. UNIX for Advanced & Expert Users

same file being opened by two users at a time

I want to avoid a situation where because two users simultaneously open a file and modify and save, leaving the original file in mess. Is there a way in UNIX to warn a user if that particular file is already being used by another user. Thanks in advance (3 Replies)
Discussion started by: paresh n doshi
3 Replies
Login or Register to Ask a Question