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

How to pass RHCE/RHCT exam! – part 4

This post will be related to the use of grep, sed, and awk to process text streams and files.

GREP

Is a command searches a file for lines containing a match to the given strings and prints the matching lines.
It is mainly used in the following combinations:

grep 'some string'  given_file
cat given_file | grep 'some string'
command | grep 'some string'

Read more