Bookmark this page

Quiz: I/O Redirection and Pipelines

Match the following items to their counterparts in the table.

Drag and drop the items to the cell by the correct answer. Each cell should contain one answer. If you wish to change an answer, either drag it to another location, or click Reset to return the quiz to its original settings.

When you have completed the quiz, click Check. Your correct answers will have a blue background and your incorrect answers will be crossed out. If you wish to try again, click Reset. Note: if you have trouble getting the quiz to function a second time, try refreshing your browser. Click Show Solution to see all of the correct answers.

2>/dev/null
&>/dev/null
>file 2>file2
&>file
| tee file
>>file 2>&1
> file 2> /dev/null
  • Result neededRedirection syntax used
    Display command output to terminal, ignore all errors.
    2>/dev/null
    Send command output to file; errors to different file.
    >file 2>file2
    Send output and errors to the same new, empty file.
    &>file
    Send output and errors to the same file, but preserve existing file content.
    >>file 2>&1
    Run a command, but throw away all possible terminal displays.
    &>/dev/null
    Send command output to both the screen and a file at the same time.
    | tee file
    Run command, save output in a file, discard error messages.
    > file 2> /dev/null
  • Revision: rh124-7-1b00421