1

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?

244boy
  • 645

2 Answers2

1

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.

Satō Katsura
  • 13,368
  • 2
  • 31
  • 50
0

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