nerdexam
CompTIA

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.

Shells, Scripting and Data Management

Question

Which of the following benefits does an alias in bash provide?

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)
  • A
    8% (2)
  • B
    4% (1)
  • D
    88% (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.

AIt provides faster lookups for commands in the system directory.

Aliases do not improve the speed of command lookups in system directories; they are text substitutions performed by the shell before command execution.

BIt creates a local copy of a file from another directory.

Creating a local copy of a file is typically done with `cp` or by symbolic links, not directly through Bash aliases.

CIt hides what command you are running from others.

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.

DIt allows a string to be substituted for the first word of a simple command.Correct

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

#bash alias#shell scripting#command shortcuts

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice