nerdexam
CompTIA

LX0-104 · Question #116

Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)

The correct answer is B. ~/.bashrc E. ~/.bash_profile. The Bash shell uses ~/.bash_profile for login shells to set up the environment and ~/.bashrc for interactive non-login shells to define shell functions, aliases, and specific shell settings.

Shells, Scripting and Data Management

Question

Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)

Options

  • A~/.bashconf
  • B~/.bashrc
  • C~/.bashdefaults
  • D~/.bash_etc
  • E~/.bash_profile

How the community answered

(19 responses)
  • A
    5% (1)
  • B
    89% (17)
  • D
    5% (1)

Why each option

The Bash shell uses ~/.bash_profile for login shells to set up the environment and ~/.bashrc for interactive non-login shells to define shell functions, aliases, and specific shell settings.

A~/.bashconf

~/.bashconf is not a standard Bash configuration file.

B~/.bashrcCorrect

~/.bashrc is read by interactive non-login shells (like when you open a new terminal window) and is commonly used for defining aliases, functions, and interactive shell-specific settings.

C~/.bashdefaults

~/.bashdefaults is not a standard Bash configuration file.

D~/.bash_etc

~/.bash_etc is not a standard Bash configuration file.

E~/.bash_profileCorrect

~/.bash_profile is read by login shells (like when you log into a text console or via SSH) and is typically used for setting environment variables and executing startup scripts that affect the entire session.

Concept tested: Bash shell configuration files (login vs. non-login)

Source: https://linux.die.net/man/1/bash

Topics

#Bash shell#shell configuration#dot files

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice