How can I view history in terminal for specific date?

9,664

You can set the history format to include the date using the following:

HISTTIMEFORMAT="%d/%m/%y %T "

Then filter for a specific date using grep:

history | grep "31/03"

More info:

Share:
9,664

Related videos on Youtube

kulwinder1986
Author by

kulwinder1986

Updated on September 18, 2022

Comments

  • kulwinder1986
    kulwinder1986 over 1 year

    How can I view the terminal history for a specific date?

    For example today is 4-apr and I want to view the history of 31-mar

  • muru
    muru about 7 years
    Note that HISTTIMEFORMAT should already have been set during this period, or bash will just use today's date.
  • Yaron
    Yaron about 7 years
    @Kamil - thanks for the message about HISTTIMEFORMAT!
  • Yaron
    Yaron over 6 years
    @kulwinder1986 - if I've answered your question please accept / up-vote my answer.