Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, Is there a way in which we can identify the time a particular command has been executed (from the history file). Thanks in Advance. Raghu....
  1. #1
    Just Joined!
    Join Date
    Mar 2006
    Posts
    4

    Finding time when a command has been executed

    Hi,

    Is there a way in which we can identify the time a particular command has been executed (from the history file).

    Thanks in Advance.
    Raghu.

  2. #2
    Just Joined!
    Join Date
    Feb 2009
    Posts
    12
    Code:
    stat /path/to/file
    For example, to see the last time the 'cp' command was used,
    Code:
    stat /bin/cp
    Of course, this only works if you have atime enabled, which most distros do by default.

  3. #3
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Not by default. Some programs do write in the log files (browse /var/log).

    There are some ways to install such a facility, of course. For example, you could re-alias certain commands so that they first invoke a log entry (Program $prg has been executed at $time by %username) and then do run the actual program.
    Debian GNU/Linux -- You know you want it.

  4. #4
    Just Joined!
    Join Date
    Feb 2011
    Posts
    1
    hi,
    can u please tell me how can this be done.
    I m new to linux n know very few things about it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...