SCA_SLES15 practice question 13 of 15

What should you do if you want to define alias commands so that each time you open a terminal window those aliases are available from the command prompt?

Full set: 69 questions
Answer options
A: Create a file named -/.alias and put your alias commands in That file. Correct answer
B: This cannot be done since aliases are session specific only.
C: List all your aliases you have defined by entering the alias --list command and piping the output to the -Abashrc file.
D: Modify the /etc/.history/USER_NAME file to include your alias commands.
E: When you create the alias initially, specify the --keep parameter.
Correct Answer:
A. Create a file named -/.alias and put your alias commands in That file.
Explanation

To make shell aliases persistent, they must be defined in a shell startup file. For the bash shell, this is typically ~/.bashrc. A common and organized practice is to create a separate file, such as ~/.alias, containing the alias definitions. This file must then be "sourced" from within ~/.bashrc (e.g., by adding the line . ~/.alias). This ensures the aliases are loaded every time a new interactive shell is started.

Why Incorrect

B. This is incorrect; aliases can be made persistent by adding them to shell startup configuration files.
C. This command would append currently defined aliases to ~/.bashrc, but it is not the standard method for defining new, persistent aliases.
D. /etc/.history is not a standard directory, and history files track commands executed, not configuration settings like aliases.
E. The alias command does not have a --keep parameter for making aliases persistent.

References

- SUSE Linux Enterprise Server 15 SP4 Administration Guide, Chapter 1, Section 1.4, "Important Files". It identifies ~/.bashrc as the "user's individual configuration file for the Bash" where aliases and functions are defined.

- bash(1) man page, section "FILES". It describes ~/.bashrc as the "individual per-interactive-shell startup file."

Scroll to Top