Remove only the ll alias from the current Bash.
Keep all other aliases.
Which command is appropriate?
unalias NAME removes one named alias. Adding -a removes every alias, so it must not be used when other aliases should remain.
Detailed explanation
unset llIncorrect. unset does not remove an alias definition.
alias -aIncorrect. alias -a is not the Bash form for removing one alias.
unalias -aIncorrect. unalias -a removes all aliases.
unalias llCorrect. unalias ll removes only ll.
Try it yourself
An example you can run in a temporary verification environment.
bash --noprofile --norc -ic "alias ll='printf ok'; unalias ll; alias ll 2>/dev/null || echo removed"Expected result
removedKey points
- unalias NAME removes one
- -a removes all
- unset targets variables or functions
Notes
- Environment: GNU Bash 5.2 / 一時対話シェル
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
unalias
A shell builtin that removes a named alias definition.
-a
The unalias option that targets every alias currently defined.
unset
A builtin that removes shell variables or functions rather than aliases.