Linux Command History with date and time

前端 未结 5 1736
挽巷
挽巷 2020-12-24 12:32

I wants to check on my linux system when which command was fired - at which date and time.

I fired commands like this:

history 50 

5条回答
  •  伪装坚强ぢ
    2020-12-24 12:49

    It depends on the shell (and its configuration) in standard bash only the command is stored without the date and time (check .bash_history if there is any timestamp there).

    To have bash store the timestamp you need to set HISTTIMEFORMAT before executing the commands, e.g. in .bashrc or .bash_profile. This will cause bash to store the timestamps in .bash_history (see the entries starting with #).

提交回复
热议问题