How to pass RHCE/RHCT/RHCSA exam – part 6

In order to pass RCHE/RCHT/RHCSA exam, you also need to know how to use input/output text redirection. As a first example, let’s say you want to insert some text in a file. This can be done very symple using “>” (more than) sign.

echo "this is just a test" > /tmp/some_test_file 

This will EMPTY the contents of that file if it existed before and will insert “this is just a test” in it. If that file did not exist it will create it and will insert the given string. Now let’s say we want to append a new entry in our hosts file, so we keep the content of the file, and we just add new lines at the bottom.

Read more