Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I know the file change history?

Status
Not open for further replies.

mixmouse

Programmer
Mar 22, 2001
26
CA
I need to check one file in my system. It looks like someone changed it without the permission. I need to know the last 3 or 5 times access/change of this file. Is this possible?
I am running on AIX5.2 ML3.

Thanks.
 
I'm afraid you'll only be able to look at the last time the file changed or the last time the file was accessed.

ls -l filename ( modified time / date will be displayed )

ls -lu filename ( accessed time / date will be displayed )

These may or may not be the same.

One thing to consider are the permissions on the file ( Owner and Group as well ). That will help you determine who has access to modify the file.

If I'm way off base for what you're asking, I apologize.
 
Hi,

You could also use a simple C program like this, you have three times in the file structure.

#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>

/* returning status info on a file */
/* returns last data modification time*/

main(int argc, char *argv[])
{
int e;
struct stat *b;

b = malloc(sizeof(struct stat));

stat(argv[1],b);
printf("%s.%ld\n",argv[1],b->st_mtime);
}
 
hfaix,
You are right. From the AIX command, I can only get the last access/modified time.

markus38,
Can I use ksh or perl to get the same result?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top