Skip to main content
Linux AdministrationMediumSingle Choice

Linux Administration Question

Statement

What is the output of the following command?

echo "Hello World" | tr -d aieou

#tr#character-deletion#case-sensitivity#vowel-removal#echo
A

Hello World

B

eoo

C

Hll Wrld

Correct
D

eoo Hll Wrld

Resolution & Explanations

The tr command is used to translate or delete characters. With the -d option, it deletes specified characters from the input. In this case, tr -d aieou deletes all occurrences of the vowels 'a', 'i', 'e', 'o', and 'u' from the input string "Hello World". Note that the command is case-sensitive, so it only deletes lowercase vowels; uppercase 'W' and 'H' are not affected. The output becomes "Hll Wrld" because the 'e' and 'o' in "Hello" are removed, and the 'o' in "World" is removed, leaving a space between "Hll" and "Wrld". The incorrect outputs: "Hello World" would result if no deletion occurred; "eoo" would be the result if only vowels were kept (using -c complement); "eoo Hll Wrld" would be a mix of kept and deleted characters, which is not produced by this command.