Learn
Redirection
>>

Now we know how to overwrite a file’s contents, but what if we want to be able to add to a file without losing the original text? We can use the >> command!

$ cat deserts.txt >> forests.txt

>> takes the standard output of the command on the left and appends (adds) it to the file on the right.

Here, the output data of forests.txt will contain the original contents of forests.txt with the content of deserts.txt appended to it.

Instructions

1.

Use >> to append the contents of glaciers.txt to rivers.txt.

2.

Use cat to view the contents of rivers.txt.

Notice that we see rivers and glaciers as output.

Folder Icon

Sign up to start coding

Already have an account?