Redirection and Pipes Print

  • 0

Connecting commands together.

WHAT THE THREE STREAMS ARE

Standard input Standard output Standard error

WHY ERROR IS SEPARATE

So error messages are not mixed into data you are processing.

WHAT A SINGLE ANGLE BRACKET DOES

Sends output to a file, replacing its contents.

WHAT TWO ANGLE BRACKETS DO

Append instead of replacing.

WHY THAT DISTINCTION MATTERS

A single bracket on an existing file destroys it instantly.

WHAT A LEFT ANGLE BRACKET DOES

Feeds a file into a command as input.

WHAT A PIPE DOES

Sends one command's output into another's input.

WHY IT IS THE CENTRAL IDEA

Small tools combined do what no single tool provides.

WHAT COMMON COMBINATIONS LOOK LIKE

Listing something, filtering it, counting the result Reading a log, selecting a field, sorting, counting occurrences

WHAT TO REDIRECT ERRORS WITH

The number two before the angle bracket.

WHAT TO SEND BOTH STREAMS TO ONE PLACE

An ampersand before the angle bracket, in modern shells.

WHAT tee DOES

Writes to a file and passes the output onward.

WHEN THAT HELPS

When you want to see output and keep it.

WHAT TO DISCARD OUTPUT WITH

Redirecting to the null device.

WHERE THAT IS USED

Cron jobs, to suppress routine output.

WHAT TO NEVER SUPPRESS

Errors you have not read at least once.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot