Introduction

Get an introduction to streams of text and how they can be useful in the CLI environment.

We'll cover the following

Overview of standard streams

Long ago, if we wanted an output from a program, we had to write specific instructions into our code. If we wanted the program to take input from a keyboard, we had to write that code as well. This tightly coupled the program to the hardware on which it ran, making things pretty specialized and not easily portable. Unix introduced the concept of standard streams of data at the OS level, which meant that programs could write to these standard streams, and the OS would take care of the rest, either handling the input or displaying the output appropriately.

There are three standard streams we encounter when working on the CLI on a Unix-based system:

  • Standard output (stdout) is output from a program.
  • Standard input (stdin) is input to a program.
  • Standard error (stderr) is errors from a program.

Get hands-on with 1400+ tech skills courses.