Inspect current LANG, LC_CTYPE, LC_TIME, and other locale-category values.
Which command is appropriate?
locale without arguments displays current locale environment variables and category values.
Detailed explanation
localeCorrect. It displays the current locale and category values.
Correct. It displays the current locale and category values.
locale -aIncorrect. -a lists available locale names rather than active values.
Incorrect. -a lists available locale names rather than active values.
locale charmapIncorrect. locale charmap prints only the current character-map name.
Incorrect. locale charmap prints only the current character-map name.
iconv -lIncorrect. iconv -l lists encodings supported by iconv.
Incorrect. iconv -l lists encodings supported by iconv.
Try it yourself
An example you can run in a temporary verification environment.
localeExpected result
LANG、LC_CTYPE、LC_TIME、LC_ALLなどの一覧Key points
- locale shows current values
- -a lists available locales
- charmap shows encoding
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.