Search⌘ K
AI Features

I/O Redirection

Explore the concepts of input, output, and error stream redirection in Bash. Understand how to use operators like >, >>, <, 1>, 2>, and &> to control where data is sent or received, helping you manage files and error messages effectively in your scripts.

We'll cover the following...

Redirecting text data

Let’s suppose that we are looking for the files on the disk. We want to save the search results in a file. We use the find utility and the redirection operator 1>. Then, the utility call looks like this:

find / -path */doc/* -name README 1> readme_list.txt

We run cat readme_list.txt to view readme_list.txt.

Run the commands discussed in this lesson in the terminal below.

Terminal 1
Terminal
Loading...

The command creates the readme_list.txt file in the current directory and writes the find utility’s output there. The ...