This is automatically done. Bash stores your commands in ~/.bash_history
. If you want to have a look at the history, either print the output of this file using one of
cat ~/.bash_history
less ~/.bash_history
...any other pager or output command...
Or you can use bash's builtin command:
history
To clear the history, delete the file and clear the temp history:
rm ~/.bash_history && history -c
The history size defaults to 500 commands. You can, however, increase this by adding a line to your ~/.bashrc
file to set the HISTSIZE
variable:
HISTSIZE=<number of entries, -1 for unlimited>
This will not take effect immediately, but only to newly started sessions. To apply this, re-source the .bashrc
file:
. ~/.bashrc
or run HISTSIZE=...
in your current session.
I think the answer given here by kos is the best way I've seen so far.
Though as Software Center uses apt
, anything that it has installed would be listed too.
The command is:
zcat /var/log/apt/history.log.*.gz | cat - /var/log/apt/history.log | grep -Po '^Commandline: apt-get install (?!.*--reinstall)\K.*'
Best Answer
You can set the
history
format to include the date using the following:Then filter for a specific date using
grep
: