Timedora
Free Practice Quiz Question List

Shell Pipes and Output Redirection Online Quiz Questions

Use this free practice quiz with 20 questions to review Shell Pipes and Output Redirection, test your knowledge, and prepare for your next test or exam.

20 questions
01
Choose one
1 point

What does command | tee output.log do?

  1. A

    It sends standard error to the file and standard output to the terminal.

  2. B

    It copies its standard input to both standard output and the named file.

  3. C

    It appends standard output to the file and sends nothing to the terminal.

  4. D

    It sends standard output only to the file, replacing the file’s contents.

02
Choose all
1 point

Select all statements that correctly describe these shell redirections.

  1. A

    command > file appends standard output to the file.

  2. B

    command >> file appends standard output to the file.

  3. C

    command 2> file writes standard error to the file, replacing its previous contents.

  4. D

    command > all.log 2>&1 sends both standard output and standard error to all.log.

  5. E

    command 2>&1 > all.log sends both standard output and standard error to all.log.

03
True or false
1 point

A regular pipe (|) passes both standard output and standard error from one command to the next.

  1. A

    True

  2. B

    False

04
Written response
1 point

In command | tee OPTION output.log, what option makes tee append to output.log instead of replacing it?

05
Fill in the blank
1 point

To append a command’s standard output to a file, use command file.

06
Open ended
1 point

Explain how a regular shell pipe connects two commands and what happens to standard error. Briefly note how the Bash operator |& differs.

07
Choose one
1 point

Which statement correctly describes command | tee -a output.log?

  1. A

    tee output.log appends to the file and suppresses terminal output.

  2. B

    tee -a output.log redirects standard error to the file.

  3. C

    tee -a output.log appends to the file while continuing to copy input to standard output.

  4. D

    tee -a output.log replaces the file and sends no output to standard output.

08
Choose all
1 point

Select all statements that correctly describe a regular pipe (|).

  1. A

    It sends one command’s standard output to the next command’s standard input.

  2. B

    It does not pass standard error unless that stream is explicitly merged or redirected.

  3. C

    It allows commands to work in stages without first saving intermediate results to a file.

  4. D

    It sends standard error to the next command but leaves standard output in the terminal.

09
True or false
1 point

The command command 2>&1 > all.log sends both standard output and standard error to all.log.

  1. A

    True

  2. B

    False

10
Written response
1 point

What file descriptor number represents standard error in a typical Unix-like shell?

11
Fill in the blank
1 point

To append a command’s standard output to results.log without replacing its existing contents, use command results.log.

12
Choose one
1 point

What does command | tee output.log do?

  1. A

    It sends standard error to a file while leaving standard output unchanged.

  2. B

    It copies its standard input to standard output and to a named file.

  3. C

    It appends standard output to a file without displaying it.

  4. D

    It sends standard input directly to a file and suppresses standard output.

13
True or false
1 point

In command 2>&1 > all.log, both standard output and standard error are redirected to all.log.

  1. A

    True

  2. B

    False

14
Written response
1 point

Which shell redirection operator sends a command’s standard error to a file?

15
Choose one
1 point

Which stream does a regular shell pipe (|) pass from one command to the next?

  1. A

    It passes standard error, but not standard output.

  2. B

    It passes both standard output and standard error.

  3. C

    It passes standard output, but not standard error.

  4. D

    It passes standard input directly to the next command’s standard output.

16
True or false
1 point

In command > all.log 2>&1, standard output is sent to all.log first, and standard error is then sent to the same destination.

  1. A

    True

  2. B

    False

17
Written response
1 point

Which shell operator redirects standard output to a file, replacing that file’s previous contents if it exists?

18
Choose one
1 point

What connection does the pipe in first_command | next_command create?

  1. A

    It sends the first command’s standard output to the next command’s standard input.

  2. B

    It sends the first command’s standard error to the next command’s standard input.

  3. C

    It sends the next command’s standard output to the first command’s standard input.

  4. D

    It saves the first command’s output to a file before the next command runs.

19
Written response
1 point

In which direction does the shell process redirections in a command?

20
Choose one
1 point

What does command > out.log 2> errors.log do?

  1. A

    It writes standard output and standard error together to out.log.

  2. B

    It appends standard output to out.log and leaves standard error unchanged.

  3. C

    It writes standard error to out.log and standard output to errors.log.

  4. D

    It writes standard output to out.log and standard error to errors.log.