LX0-104 · Question #512
Which of the following benefits does an alias in bash provide?
The correct answer is D. It allows a string to be substituted for the first word of a simple command.. A Bash alias allows a short string to be substituted for a longer command or sequence of commands, simplifying and customizing command-line interactions.
Question
Options
- AIt provides faster lookups for commands in the system directory.
- BIt creates a local copy of a file from another directory.
- CIt hides what command you are running from others.
- DIt allows a string to be substituted for the first word of a simple command.
How the community answered
(24 responses)- A8% (2)
- B4% (1)
- D88% (21)
Why each option
A Bash alias allows a short string to be substituted for a longer command or sequence of commands, simplifying and customizing command-line interactions.
Aliases do not improve the speed of command lookups in system directories; they are text substitutions performed by the shell before command execution.
Creating a local copy of a file is typically done with `cp` or by symbolic links, not directly through Bash aliases.
Aliases do not hide commands; they merely provide a different name for them, and the underlying command is still executed and often visible in process lists.
An alias in Bash is a command-line shortcut that enables a user to define a string that the shell will substitute for the first word of a simple command when it is executed. This feature is commonly used to create shorter names for frequently used commands, correct common typos, or add default options to commands.
Concept tested: Bash alias functionality
Source: https://www.gnu.org/software/bash/manual/bash.html#Aliases
Topics
Community Discussion
No community discussion yet for this question.