Online Linux Terminal Logo
OnlineLinuxTerminal
← All Tutorials•Intermediate

I/O Redirection & Command Pipelines

The true power of the Unix philosophy is combining simple modular programs using pipes (`|`) and redirecting data streams with `>`, `>>`, and `2>/dev/null`.

Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Lesson Objectives

4 Steps
1Step 1: Pipe Output into Word Count

Run `ls -la /var/log | wc -l` to count how many files exist in the system log directory.

2Step 2: Redirect Output to a Log File

Run `date > timestamp.txt` to capture the current system date and save it to a file.

3Step 3: Append Content without Overwriting

Run `uname -a >> timestamp.txt` using the `>>` operator to append kernel details.

4Step 4: Inspect Combined Output Stream

Run `cat timestamp.txt` to verify both the date and system details exist.

💡 Pro Tip:

`>` overwrites the destination file, while `>>` appends to the end of the file safely.

bash — terminal