Tags » Bash History

History commands in Bash

  1. Print History: $ history (stored in ~/.bash_history)

  2. Print ’n’ lines: $ history 3

  3. Repeat Most Recent Command: $ !!

    (Or press ‘up’ to display the last command)

  4. 178 more words

Clearing bash history on exit of any kind

Nothing fancy here, it is just a reminder of tips already well known:

In ~/.bash_logout

history -c
history -w

In ~/.bashrc

exit_session() {
 . "$HOME/.bash_logout"
trap exit_session SIGHUP

alias exit='. 25 more words

How to use Linux Bash History / history command?

If you are spending lot of time on Linux command line or maintaining a server, probably you may want to keep track of commands which were executed on your machine and  knowing the history command usage will speed up your work flow. 968 more words