Reverse the lines of a file

Sometimes one needs things that cannot be done with a built-in function of Word or Libre Office Writer.
I needed to reverse the lines of a file. The IMHO most elegant solution to do this was:

cat -n myfile | sort -nr | cut -c 8- > outfile.txt

Basically it is enumerating the lines of the file, sorting them in reverse order and then cutting away the numbers. Isn’t bash beautiful?

Of course, Linux also has dedicated command to reverse the lines of a file, it is called tac (‘cat’ reversed).