No, to check the bash history, you use the built-inI know to check history we use falling command:
export HISTTIMEFORMAT='%F %T '
But it displays history of present day only. How could someone check history of past days?
'%F %T '- whenever you use the
historycommand, you'll get every single command in the file listed, but it will have the "number" of the command in the history file and the timestamp consisting of the date (%F) and the time (%T), followed by the command.
1995 2020-10-12 16:55:05 ls -t | head -n 10
history | \grep 2020-10-11
history | \grep "$(date --date='yesterday' +%F)"
history | \grep "$(date --date='-3 weeks' +%F"
Also very good points!A few comments about this.
"Most" (not all) distros keep history since the last reboot.
However the scroll-back buffer in your console/terminal may truncate the output.
Some distro's rotate the history every so often, but you can change this.
Another thing to keep in mind, is not every has the same shell session.
Not even the same user has the same shell session always. For example
you could login as user Bob, and I could login as user Mike, and if we both typed
history at the same time, we would see two different lists.
We could also both login as user root at the same time, but it would still be two different sessions,
so our history would be different during those sessions.