Display the last N lines of a text file with line numbers in reverse order
cat -n is kind of an anti pattern. The cat command is for displaying the content, adding line numbering is a violation of the single responsibility principle. 

tac is not portable. Although it's quite common in Linux, not so much in UNIX and osx. 

Instead of head --lines=3 it's more common to use the shorter form head -n 3.

I don't quite get why you would want to see the last n lines reversed. If reversing is not important, then a portable alternative to print the last n lines with line numbers could be using awk and tail:

awk '{ print NR ":" $0 }' file | tail -n 3


You could write the whole thing in Awk, and also reverse the lines. It will be longer to write, but portable, and solved in a single process rather than a pipeline of multiple commands.