Is there a way to save all my typed terminal commands and view it like history in a log book?
View Terminal Command History in Ubuntu – How to Guide
bash-historyhistory
bash-historyhistory
Is there a way to save all my typed terminal commands and view it like history in a log book?
Best Answer
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 ofOr you can use bash's builtin command:
To clear the history, delete the file and clear the temp history:
The history size defaults to 500 commands. You can, however, increase this by adding a line to your
~/.bashrc
file to set theHISTSIZE
variable:This will not take effect immediately, but only to newly started sessions. To apply this, re-source the
.bashrc
file:or run
HISTSIZE=...
in your current session.