nerdexam
CompTIA

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.

GNU and Unix Commands

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)
  • A
    90% (35)
  • B
    3% (1)
  • D
    5% (2)
  • E
    3% (1)

Why each option

Bash stores command history in the file .bash_history located in the user's home directory by default.

A.bash_historyCorrect

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.

B.bash_histfile

.bash_histfile is not a recognized Bash history filename; it does not exist by default.

C.history

.history was used by older shells such as csh and tcsh, not by Bash.

D.bashrc_history

.bashrc_history is not a valid or recognized Bash file; no such default exists.

E.history_bash

.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

#bash history#.bash_history#shell configuration

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice