Change only the locale-dependent ordering used by commands such as sort.
Which environment variable is relevant?
LC_COLLATE controls string comparison and collation rules used for ordering.
Detailed explanation
LC_TIMEIncorrect. LC_TIME controls date and time names and formats.
Incorrect. LC_TIME controls date and time names and formats.
LC_NUMERICIncorrect. LC_NUMERIC controls numeric formatting.
Incorrect. LC_NUMERIC controls numeric formatting.
LC_COLLATECorrect. LC_COLLATE controls string collation and ordering.
Correct. LC_COLLATE controls string collation and ordering.
LC_MONETARYIncorrect. LC_MONETARY controls currency formatting.
Incorrect. LC_MONETARY controls currency formatting.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s\n' b A a | LC_ALL=C sortExpected result
A
a
bKey points
- COLLATE controls ordering
- TIME controls dates
- NUMERIC controls number format
Notes
- Environment: POSIX C locale / sort
- 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.