Multiple choice technology operating systems

Command used to supress all spaces from a given file named test.

  1. cat test | cut ' '

  2. cat test | tr -s ' '

  3. cat test | tr ' ' ''

  4. cat test > test 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The 'tr -s' option squeezes repeated characters, so 'tr -s ' '' squeezes multiple consecutive spaces into single spaces. The cut command is for field extraction, not character suppression. Option B correctly uses tr with -s flag to compress multiple spaces into one.