Linux Command History with date and time

前端 未结 5 1741
挽巷
挽巷 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:52

    In case you are using zsh you can use for example the -E or -i switch:

    history -E
    

    If you do a man zshoptions or man zshbuiltins you can find out more information about these switches as well as other info related to history:

    Also when listing,
     -d     prints timestamps for each event
     -f     prints full time-date stamps in the US `MM/DD/YY hh:mm' format
     -E     prints full time-date stamps in the European `dd.mm.yyyy hh:mm' format
     -i     prints full time-date stamps in ISO8601 `yyyy-mm-dd hh:mm' format
     -t fmt prints time and date stamps in the given format; fmt is formatted with the strftime function with the zsh extensions  described  for  the  %D{string} prompt format in the section EXPANSION OF PROMPT SEQUENCES in zshmisc(1).  The resulting formatted string must be no more than 256 characters or will not be printed
     -D     prints elapsed times; may be combined with one of the options above
    

提交回复
热议问题