Categories
Linux Tutorial Series

Linux Tutorial Series – 55 – Pipelines

Here is the video version, if you prefer it:

This post is about becoming a plumber. Wait, what?! I thought this was a Linux related post. Oh sorry, my mistake. It is. Let’s learn about pipelines (no plumbing needed).

Pipelines are a way to redirect one command’s standard output to the other command’s standard input. (Shotts, 2019)⁠ Essentially, you are “chaining commands” here. Here is an example I found myself using most often:

mislav@mislavovo-racunalo:~/Documents$ ls | grep test

test.txt

This is something I most often use. I list out the contents of a directory using ls (or the contents of a file using cat) and then I use grep to find a file or a line that I am interested in.

Pipelines can be arbitrarily long.

Thank you for reading!

References

Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 85-90