Challenge - 5 Problems
tr Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this
tr command?Given the input string
hello world, what is the output of the command echo 'hello world' | tr 'a-z' 'A-Z'?Linux CLI
echo 'hello world' | tr 'a-z' 'A-Z'
Attempts:
2 left
💡 Hint
The
tr command can convert lowercase letters to uppercase by specifying ranges.✗ Incorrect
The command translates all lowercase letters (a-z) to their uppercase equivalents (A-Z), so 'hello world' becomes 'HELLO WORLD'.
💻 Command Output
intermediate1:30remaining
What does this
tr command output?What is the output of
echo '123-456-7890' | tr -d '-'?Linux CLI
echo '123-456-7890' | tr -d '-'
Attempts:
2 left
💡 Hint
The
-d option deletes characters specified in the set.✗ Incorrect
The command deletes all dashes '-' from the input, resulting in '1234567890'.
💻 Command Output
advanced1:30remaining
What is the output of this
tr command with squeeze?Given the input
echo 'aaabbbcccaaa' | tr -s 'a', what is the output?Linux CLI
echo 'aaabbbcccaaa' | tr -s 'a'
Attempts:
2 left
💡 Hint
The
-s option squeezes repeated characters in the set into one.✗ Incorrect
The command squeezes repeated 'a's into a single 'a', so 'aaabbbcccaaa' becomes 'abbbccca'.
💻 Command Output
advanced1:30remaining
What error does this
tr command produce?What error message results from running
echo 'test' | tr 'a-z' 'A-Z' '0-9'?Linux CLI
echo 'test' | tr 'a-z' 'A-Z' '0-9'
Attempts:
2 left
💡 Hint
The
tr command accepts only two sets of characters for translation.✗ Incorrect
The command provides three arguments to
tr, which expects only two sets. This causes an error about an extra operand.🚀 Application
expert2:00remaining
How many characters are in the output after this
tr command?Given the input string
echo 'aabbccddeeff' | tr -d 'bdf', how many characters does the output contain?Linux CLI
echo 'aabbccddeeff' | tr -d 'bdf'
Attempts:
2 left
💡 Hint
Count the characters after deleting all 'b', 'd', and 'f'.
✗ Incorrect
The input has 12 characters: a a b b c c d d e e f f. Deleting 'b', 'd', and 'f' removes 2 b's, 2 d's, and 2 f's (6 total). Remaining characters: a a c c e e (6 characters). So output length is 6.