Learn
Redirection
>
$ cat deserts.txt > forests.txt

> takes the standard output of the command on the left, and redirects it to the file on the right. Here the standard output of cat deserts.txt is redirected to forests.txt.

Note that > overwrites all original content in forests.txt. When you view the output data by using cat on forests.txt, you will see only the contents of deserts.txt.

Instructions

1.

Let’s practice redirection some more. First use ls to list the contents of the working directory.

This is the filesystem we’ll work with. You can reference it anytime here.

2.

Use cat to view the contents of continents.txt.

3.

Then use > to redirect the contents of oceans.txt to continents.txt.

4.

Use cat to view the contents of continents.txt again.

Notice that we now only see oceans as output.

Folder Icon

Sign up to start coding

Already have an account?