← Linux & the Command Line tutorial

Linux & the Command Line

Piping & Redirection

The pipe | feeds one command's output straight into another's input, this is what makes the command line so powerful, chaining small, focused tools into a bigger one.

Example: filtering and logging

$ ls -la | grep ".txt"
$ echo "Deploy finished" >> deploy.log

The first command lists only files whose names contain ".txt", the same grep filtering idea from the previous lesson, applied to a directory listing instead of a process list. > redirects output into a file, overwriting whatever was there before; >> (used above) appends instead, adding a new line to deploy.log without erasing anything already logged, exactly the distinction you want when writing to a log file that's supposed to accumulate history rather than get wiped on every write.

Example
$ ls -la | grep ".txt"
$ echo "Deploy finished" >> deploy.log
Output
The first command lists only files whose names contain ".txt". The second appends a line to deploy.log without erasing what was already there.
Ready to go further?

These free tutorials are a preview, our Cybersecurity cohort covers it in depth, with a real project and a cohort alongside you. Closes Nov 30

Enroll in Cybersecurity

Cookie preferences

Choose what you're comfortable with. You can change this any time from the footer.

Don't miss out

Ready to build something real?

Create a free account to enroll in a track, and get notified the moment a cohort opens.

Create free account