Read ASCII lowercase letters from standard input.
Convert them to the corresponding uppercase letters on standard output.
Which filter is correct?
tr translates, deletes, or squeezes characters. Two character sets map each character in the first set to the corresponding character in the second.
Detailed explanation
tr -d '[:lower:]'Incorrect. -d deletes lowercase characters instead of converting them.
Incorrect. -d deletes lowercase characters instead of converting them.
tr '[:upper:]' '[:lower:]'Incorrect. This converts uppercase to lowercase, the opposite direction.
Incorrect. This converts uppercase to lowercase, the opposite direction.
sort -fIncorrect. sort -f ignores case for sorting but does not translate characters.
Incorrect. sort -f ignores case for sorting but does not translate characters.
tr '[:lower:]' '[:upper:]'Correct. It maps the lowercase character class to the uppercase class.
Correct. It maps the lowercase character class to the uppercase class.
Try it yourself
An example you can run in a temporary verification environment.
printf 'Linux 101
' | LC_ALL=C tr '[:lower:]' '[:upper:]'Expected result
LINUX 101Key points
- tr processes standard input
- Character classes
- The -d deletion option
Notes
- Environment: GNU coreutils 9.x / Cロケール
- 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.