Command for checking modification history on file


 
Thread Tools Search this Thread
Operating Systems Solaris Command for checking modification history on file
# 1  
Old 09-17-2010
Command for checking modification history on file

What is the command for checking modification history on file?

---------- Post updated at 01:20 PM ---------- Previous update was at 12:35 PM ----------

Let me rephrase this. On a regular Unix file can I at least check to see the time and date history modification of the file?
# 2  
Old 09-17-2010
Unix files keep three times:

last time the file was accessed, modified, or metadata changed (eg chmod)

Code:
$ ls -ce passwd
-rw-r--r--   1 root     root         894 Sep 16 14:18:29 2010 passwd
$ ls -ue passwd
-rw-r--r--   1 root     root         894 Sep 17 12:45:00 2010 passwd
$ ls -le passwd
-rw-r--r--   1 root     root         894 Sep 16 14:18:29 2010 passwd

The -e modifier makes the time display in seconds -l is mtime, -c ctime, -u atime.
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 09-20-2010
You can also use stat command to see all :

Code:
$ stat /etc/passwd
  File: "/etc/passwd"
  Size: 2528            Blocks: 8          IO Block: 4096   Regular File
Device: 301h/769d       Inode: 212442      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: Tue Jun  1 13:23:28 2010
Modify: Tue Jun  1 13:23:28 2010
Change: Sun Sep 19 00:15:53 2010

# 4  
Old 09-20-2010
stat is not a command shipped with Solaris. It is part of sunfreeware's coreutils package, for example.
# 5  
Old 09-20-2010
You might want to use ls extended attributes display option to get these times.
Code:
$ ls -l -% all bootenv.rc 
-rw-r--r--   1 root     root        1317 Mar  9  2010 bootenv.rc
         timestamp: atime         Sep 20 09:19:21 2010 
         timestamp: ctime         Mar  9 03:45:24 2010 
         timestamp: mtime         Mar  9 03:45:23 2010 
         timestamp: crtime        Mar  9 03:24:28 2010

Note also that you'll get the file creation time when running on ZFS.
This User Gave Thanks to jlliagre For This Post:
# 6  
Old 09-21-2010
This is what I got when I tried jilliagre's suggestion:

Code:
$ ls -l -% all authorized_keys
ls: illegal option -- %
usage: ls -1RaAdCxmnlhogrtuvVcpFbqisfHLeE@ [files]

# 7  
Old 09-21-2010
The syntax I suggested works only with SunOS 5.11 based distributions. Sorry for not mentioning that.
This User Gave Thanks to jlliagre For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[ksh] how to reload history file without entering a command

I'm basically looking for the ksh equivalent of bash's PROMPT_COMMAND="history -r", where simply redrawing the command prompt in a terminal will cause ksh to reload the history file. At the risk of sounding incredibly lazy (in which case I would be guilty as charged), I've noticed that if I have... (13 Replies)
Discussion started by: DevuanFan
13 Replies

2. 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

3. AIX

Checking the command history file in AIX

Hello, The system has been rebooted and I need to see the commands executed in the system prior to restart by the oracle user.The history command is not showing me the commands executed prior to reboot. Please advise. Best regards, Vishal (1 Reply)
Discussion started by: Vishal_dba
1 Replies

4. Shell Programming and Scripting

UNIX CO command for file version history

Hello :) I'm a newb when it comes to shell scripting and was wondering about a command(s) for a script that could be used to checkout a certain number of version/revision histories of a file. I know for the latest revison you "co filename" or for a certain revision number "co -r*.* filename"... (2 Replies)
Discussion started by: MN-DBA
2 Replies

5. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies

6. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies

7. Shell Programming and Scripting

File modification history

Can anyone please suggest an alternate command for "stat" . I am trying this on Solaris 5.9 , but the command doesn't exist. Basically i need to see one particalar file modification history. Any help is appreciated. (4 Replies)
Discussion started by: mk1216
4 Replies

8. UNIX for Dummies Questions & Answers

How to track the modification history on file in unix

How do we track the modification history on a file in UNIX. IS there any command or any script that we could run. Many Thanks (5 Replies)
Discussion started by: RSPDaemon
5 Replies

9. Solaris

Modification history for Crontab

Hi all - I've searched the forums and seen a few questions related, but nothing which explicitly answers what I'm looking for. I need to know if there's ANY way to get the modification history of any users crontab. Yes, I know that crontabs are in /var/spool/cron. I know that the... (2 Replies)
Discussion started by: amcq
2 Replies

10. UNIX for Dummies Questions & Answers

command for modification date of a file

Good morning, I would like to find all files of a certain type and display their name as well as their modification date. In order to do this, I would do the following: find ./ -name *.csv | ???????? My question: what to put after the pipe instead of the question marks? Is there a basic... (5 Replies)
Discussion started by: scampsd
5 Replies
Login or Register to Ask a Question