Learn
Redirection
Your First Redirect

How does redirection work?

$ echo "Hello" > hello.txt

The > command redirects the standard output to a file. Here, "Hello" is entered as the standard input, and is then redirected to the file hello.txt by > .

As a reminder, the cat command outputs the contents of a file to the terminal. When you type:

$ cat hello.txt

the contents of hello.txt are displayed.

Instructions

1.

Let’s try our first redirect!

In the terminal, type:

echo "Hello World" > hello.txt
2.

Then type:

cat hello.txt

You should see "Hello World" printed to the console.

Folder Icon

Sign up to start coding

Already have an account?