LX0-103 · Question #200
Which of the following files, located in the user home directory, is used to store the Bash history?
The correct answer is A. .bash_history. Bash stores command history in the file .bash_history located in the user's home directory by default.
Question
Which of the following files, located in the user home directory, is used to store the Bash history?
Options
- A.bash_history
- B.bash_histfile
- C.history
- D.bashrc_history
- E.history_bash
How the community answered
(39 responses)- A90% (35)
- B3% (1)
- D5% (2)
- E3% (1)
Why each option
Bash stores command history in the file .bash_history located in the user's home directory by default.
The default value of the HISTFILE environment variable in Bash is ~/.bash_history, and this file is written automatically when a Bash session exits. Each command entered during the session is appended to this file so it persists across sessions. The filename and location can be overridden by setting HISTFILE to a different path.
.bash_histfile is not a recognized Bash history filename; it does not exist by default.
.history was used by older shells such as csh and tcsh, not by Bash.
.bashrc_history is not a valid or recognized Bash file; no such default exists.
.history_bash is not a recognized Bash history filename and is not created by default.
Concept tested: Bash HISTFILE default location .bash_history
Source: https://www.gnu.org/software/bash/manual/bash.html#Bash-History-Facilities
Topics
Community Discussion
No community discussion yet for this question.