nerdexam
CompTIA

LX0-104 · Question #305

Which of the following benefits does an alias provide?

The correct answer is B. It prevents having to type long commands. Command aliases in a shell allow users to define shorter or more convenient names for longer or frequently used commands and their options, simplifying command-line interaction.

Shells, Scripting and Data Management

Question

Which of the following benefits does an alias provide?

Options

  • AIt provides faster lookups for commands.
  • BIt prevents having to type long commands
  • CIt hides from others the command that is being run.
  • DIt creates a local copy of a file from another directory.

How the community answered

(51 responses)
  • A
    4% (2)
  • B
    94% (48)
  • C
    2% (1)

Why each option

Command aliases in a shell allow users to define shorter or more convenient names for longer or frequently used commands and their options, simplifying command-line interaction.

AIt provides faster lookups for commands.

Aliases do not provide faster lookups; they simply substitute one string for another before the shell attempts to find and execute the command.

BIt prevents having to type long commandsCorrect

An alias is a shell feature that allows a user to replace a command, a set of commands, or a script with a shorter, more memorable name. This significantly reduces the amount of typing required for complex or frequently used commands, improving efficiency and reducing the chance of typos.

CIt hides from others the command that is being run.

Aliases do not hide commands; they are typically defined in shell configuration files (e.g., .bashrc, .zshrc) and are visible to anyone inspecting those files or the shell's alias list.

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

Aliases are for command substitution, not for file operations like creating local copies; that functionality is provided by commands like `cp` or `rsync`.

Concept tested: Shell aliases benefits

Source: https://man7.org/linux/man-pages/man1/bash.1.html

Topics

#shell alias#command shortcut#productivity

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice