0

This command does not give time & date when command was executed. Is this possible to check date & time with history command or other command.

$ history
    1  cd /strswork/strsapp/applications
    2  ll
    3  cd UM1
    4  ll
    5  cd DEV/oldlogs
    6  ls -ltr
    7  cd ..
    8  ls -ltr
    9  tail -10 log.txt
   10  more log.txt
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
jazz
  • 27

2 Answers2

0

The history command reads from the ~/.bash_history file which only stores the commands, one on each line. It does not store any timing information.

There are tools that can log both commands and times e.g. auditd (How to track/log commands executed on a shell?)

hardillb
  • 408
  • 2
  • 10
0

edit .bash_profile or /etc/profile
add HISTTIMEFORMAT="%d/%m/%y %T " end of the line. and refresh it with the below command:

source /etc/profile
GAD3R
  • 66,769