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.
set -oIncorrect. set -o displays shell-option states.
aliasCorrect. alias without arguments lists the current aliases.
unalias -aIncorrect. 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
Alias state
The command-name expansion definitions held by the current interactive shell.
State query
An operation that displays current definitions without changing shell state.
Shell option
A setting that changes how the shell parses or executes commands.