Linux Command History with date and time

前端 未结 5 1733
挽巷
挽巷 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

    HISTTIMEFORMAT="%d/%m/%y %H:%M "
    

    For any commands typed prior to this, it will not help since they will just get a default time of when you turned history on, but it will log the time of any further commands after this.

    If you want it to log history for permanent, you should put the following line in your ~/.bashrc

    export HISTTIMEFORMAT="%d/%m/%y %H:%M "
    

提交回复
热议问题