summaryrefslogtreecommitdiff
path: root/devdocs/bash/bash-history-facilities.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/bash/bash-history-facilities.html
new repository
Diffstat (limited to 'devdocs/bash/bash-history-facilities.html')
-rw-r--r--devdocs/bash/bash-history-facilities.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/devdocs/bash/bash-history-facilities.html b/devdocs/bash/bash-history-facilities.html
new file mode 100644
index 00000000..2697c28a
--- /dev/null
+++ b/devdocs/bash/bash-history-facilities.html
@@ -0,0 +1,6 @@
+<h1 class="section">Bash History Facilities</h1> <p>When the <samp>-o history</samp> option to the <code>set</code> builtin is enabled (see <a href="the-set-builtin">The Set Builtin</a>), the shell provides access to the <em>command history</em>, the list of commands previously typed. The value of the <code>HISTSIZE</code> shell variable is used as the number of commands to save in a history list. The text of the last <code>$HISTSIZE</code> commands (default 500) is saved. The shell stores each command in the history list prior to parameter and variable expansion but after history expansion is performed, subject to the values of the shell variables <code>HISTIGNORE</code> and <code>HISTCONTROL</code>. </p> <p>When the shell starts up, the history is initialized from the file named by the <code>HISTFILE</code> variable (default <samp>~/.bash_history</samp>). The file named by the value of <code>HISTFILE</code> is truncated, if necessary, to contain no more than the number of lines specified by the value of the <code>HISTFILESIZE</code> variable. When a shell with history enabled exits, the last <code>$HISTSIZE</code> lines are copied from the history list to the file named by <code>$HISTFILE</code>. If the <code>histappend</code> shell option is set (see <a href="bash-builtins">Bash Builtin Commands</a>), the lines are appended to the history file, otherwise the history file is overwritten. If <code>HISTFILE</code> is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated to contain no more than <code>$HISTFILESIZE</code> lines. If <code>HISTFILESIZE</code> is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. </p> <p>If the <code>HISTTIMEFORMAT</code> is set, the time stamp information associated with each history entry is written to the history file, marked with the history comment character. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for the following history entry. </p> <p>The builtin command <code>fc</code> may be used to list or edit and re-execute a portion of the history list. The <code>history</code> builtin may be used to display or modify the history list and manipulate the history file. When using command-line editing, search commands are available in each editing mode that provide access to the history list (see <a href="commands-for-history">Commands For Manipulating The History</a>). </p> <p>The shell allows control over which commands are saved on the history list. The <code>HISTCONTROL</code> and <code>HISTIGNORE</code> variables may be set to cause the shell to save only a subset of the commands entered. The <code>cmdhist</code> shell option, if enabled, causes the shell to attempt to save each line of a multi-line command in the same history entry, adding semicolons where necessary to preserve syntactic correctness. The <code>lithist</code> shell option causes the shell to save the command with embedded newlines instead of semicolons. The <code>shopt</code> builtin is used to set these options. See <a href="the-shopt-builtin">The Shopt Builtin</a>, for a description of <code>shopt</code>. </p><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br>
+ <a href="https://www.gnu.org/software/bash/manual/html_node/Bash-History-Facilities.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Bash-History-Facilities.html</a>
+ </p>
+</div>