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.
Question
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)- A4% (2)
- B94% (48)
- C2% (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.
Aliases do not provide faster lookups; they simply substitute one string for another before the shell attempts to find and execute the command.
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.
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.
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
Community Discussion
No community discussion yet for this question.