How does redirection work?
$ echo "Hello" > hello.txt
> 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.
Let’s try our first redirect!
In the terminal, type:
echo "Hello World" > hello.txt
You should see
"Hello World" printed to the console.