This question already has an answer here:

Below is the tail statement:

tail -4 FDECMP1_$$.log

I need to print the last 4 lines of file FDECMP1_$$.log in Red.

marked as duplicate by Kusalananda, Michael Homer, cas, Jeff Schaller, Stephen Kitt linux Feb 14 '18 at 14:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


This command will do the job:

printf "%s" $(printf '\033[0;31m');tail -4 FDECMP1_$$.log
  • Maybe you need to reset the colour after the tail command, though. – Ned64 Feb 14 '18 at 8:32

As @galoget showed, you can use the ANSI escape sequences to change the coloring of shell texts.

This answer has more information on this and a nice xterm-256-color-chart to conveniently find the correct color for your purposes.

  • Why answer the question again when it is already answered? In these cases, please add a comment to the existing answer, instead. – Ned64 Feb 14 '18 at 8:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.