< Bash programming

Bash Command history feature allows to recall, edit and rerun previous commands. Also allows commands to be saved using the history -a command[1][2].

Variables to control Bash History:

  • HISTFILE[3]: The default value is ~/.bash_history
  • HISTFILESIZE
  • HISTTIMEFORMAT[4]

Usage

  • Basic example:
export PROMPT_COMMAND='history -a'
  • Advanced examples:


Activities

  1. Install https://github.com/ohmybash bash customization

See also

  1. https://unix.stackexchange.com/questions/145250/where-is-bashs-history-stored
  2. https://www.gnu.org/software/bash/manual/bash.html#Bash-History-Builtins
  3. <https://www.gnu.org/software/bash/manual/bash.html#index-HISTFILE
  4. https://www.gnu.org/software/bash/manual/bash.html#index-HISTTIMEFORMAT
  5. https://www.cyberciti.biz/faq/unix-linux-bash-history-display-date-time/
  6. https://gist.github.com/NISH1001/bf2b713418b4e2ede8e6a7373b42c4c1
  7. https://unix.stackexchange.com/questions/457107/sending-bash-history-to-syslog
This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.