$ 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.
> 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.
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.
cat to view the contents of continents.txt.
> to redirect the contents of oceans.txt to continents.txt.
cat to view the contents of continents.txt again.
Notice that we now only see oceans as output.