historyΒΆ

History path ~/.bash_history.

Show history of commands:

history
        20          # show last 20 commands
        -c          # clean history (don't forgot clear .bash_history file)
        -d <num>    # clear command

set +o history  # off save history
set -o history  # on save history

echo $HISTSIZE  # show history size

<space>command  # don't save history of this command

Exec command from history:

!<num>      # show and exec specific command
!!          # show and exec last command

Add time to history:

echo "export HISTTIMEFORMAT="%d.%m.%Y-%H:%M:%S \"" >> ~/.bashrc
source .bashrc