List locale names generated or installed on the system without changing settings.
Which command is appropriate?
locale -a lists locale names available on the current system.
Detailed explanation
localeIncorrect. locale displays active settings.
Incorrect. locale displays active settings.
locale -aCorrect. -a lists available locale names.
Correct. -a lists available locale names.
locale -mIncorrect. -m lists available character maps.
Incorrect. -m lists available character maps.
iconv -lIncorrect. iconv -l lists conversion encodings, not locale names.
Incorrect. iconv -l lists conversion encodings, not locale names.
Try it yourself
An example you can run in a temporary verification environment.
locale -a | sed -n '1,10p'Expected result
C、C.utf8など環境に導入されたロケール名Key points
- -a lists all locales
- -m lists charmaps
- The list depends on installed data
Notes
- Environment: POSIX locale / 読み取りのみ
- 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.