Redirection and Pipelines

In the text processing lesson, we learned how to select, concatenate, and sort text files, and used grep to print any lines of any file to the screen. However, all of the output was printed to screen — there will be times when we want to save this output in another file rather than simply seeing it displayed. This is called output redirection, and you’ll be learn how to do it over the course of this lesson.

In this lesson, you will discover how to redirect output from one command to an empty file, and redirect the output from the screen to files. You’ll also learn many additional commands, such as touch and printf that are useful for creating empty files and redirecting output.

In this lesson, we will also discuss the concept of pipelines, how they’re used, and why they’re important. The basic idea of a pipeline is to cut off the intermediate step of writing to a file and connect the output of a command to the input of another command. Building effective data pipelines can greatly improve workflow efficiency on big data analysis and data science projects.

As you work through each concept, you will be given an opportunity to practice what you have learned so far. The terminal inside of the lesson includes answer checking so you can ensure that you’ve fully mastered each concept before learning the next concept.


  • How to redirect output to files
  • How to create empty files
  • The importance of pipelines
  • How to use pipelines

Lesson Outline

  1. Printing User Input
  2. Redirecting Output With >
  3. Redirecting Output With >>
  4. Creating Empty Files
  5. Why Pipelines?
  6. Using Pipelines
  7. The Unix Philosophy
  8. Trying to Redirect Errors
  9. Next Steps
  10. Takeaways

Get started for free

No credit card required.

Or With

By creating an account you agree to accept our terms of use and privacy policy.