List the aliases currently defined in Bash without changing them.
Which command is appropriate?
alias with no arguments lists current aliases in a reusable form. unalias -a would remove them, not display them.
Detailed explanation
envIncorrect. env displays environment variables, not aliases.
Incorrect. env displays environment variables, not aliases.
set -oIncorrect. set -o displays shell-option states.
Incorrect. set -o displays shell-option states.
aliasCorrect. alias without arguments lists the current aliases.
Correct. alias without arguments lists the current aliases.
unalias -aIncorrect. unalias -a deletes all aliases.
Incorrect. unalias -a deletes all aliases.
Try it yourself
An example you can run in a temporary verification environment.
bash --noprofile --norc -ic "alias demo='printf ok'; alias"Expected result
alias demo=...を含む一覧Key points
- alias alone lists definitions
- It does not change state
- unalias removes definitions
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
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.