This question already has an answer here:

I want to list my host server's history commands time.

I know use the export HISTTIMEFORMAT="[%Y.%m.%d %H:%M:%S]" in /etc/profile I can record the time in history, but if I want to list the command time before configured to /etc/profile.

Is there other method to find the command time? or a file changed times?

marked as duplicate by muru, Stephen Rauch, peterh, DopeGhoti, sebasth Oct 18 '17 at 6:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


There are a number of things you can do to log command times, the easiest being accounting (cf. man accton), but all of them have to be turned on explicitly. If you didn't turn on accounting first there is no way to tell which commands have run in the past, let alone when.


The file times can easiest be viewed using stat, eg:

$ stat Vagrantfile
  File: 'Vagrantfile'
  Size: 3090            Blocks: 4          IO Block: 65536  regular file
Device: a0d483c6h/2698281926d   Inode: 11258999068526935  Links: 1
Access: (0644/-rw-r--r--)  Uid: (1864414/ VW25G2A)   Gid: (1049089/ UNKNOWN)
Access: 2017-10-17 14:14:29.209303600 +0200
Modify: 2017-10-17 14:14:29.209303600 +0200
Change: 2017-10-17 14:14:29.209303600 +0200
 Birth: 2017-10-17 13:36:14.303951300 +0200

Not the answer you're looking for? Browse other questions tagged or ask your own question.