- All right, let me create this file, users.
And in this file, users,
let me enter all that we need.
(keyboard clacking)
Something like this.
It's all about text patterns here.
And first we are going to use grep
to filter all lines that contain the text, "anna."
So grep anna on users,
and what do we get?
There we go.
And you can see that the text that we were looking for
is indicated in red.
That's the grep --colors option
that has been set as a default option
doing that for us.
So next, we need to use the appropriate tool
to print the last line only from this file.
That will be tail -n on users.
Small detail.
In older versions of tail and head,
you needed tail -n followed by the number
to print the last line,
but in newer versions you don't have to use the -n anymore,
you can just use minus followed by the number.
Next, we print the contents of this file
on the screen in reversed order.
That will be tac.
So tac users,
and there we go, contents of the file in the opposite order.
And that's all.