Any specific output program? It depends on the program sending the data through the pipe. head, tail, etc aren't the ones removing the colors, it's the program generating the data that usually check if the output is going to the console (colored), a file or pipe (not colored). Try out multitail ¹.
This is an übergeneralization of tail -f. You can watch multiple files in separate windows, highlight lines based on their content, and more. multitail -c /path/to/log The colors are configurable.
If the default color scheme doesn't work for you, write your own in the config file. For example, call multitail -cS amir_log /path/to/log with the following ~/.multitailrc. 4.
Post-processing tail Output Using Standard Linux Utilities In certain circumstances, we're limited to using only the standard Linux commands. In such cases, one of our options is to generate colored text by processing tail output. We can achieve this by including the escape sequences we need to generate colored output.
What I would like to do is craft something that would highlight WARN in yellow and ERROR in red, and MicroKernel in green. I tried just piping grep --color=auto multiple times, but the only color that survives is the last command in the pipe. Is there a one liner to do this? Or even a many-liner? Is it possible to have the more, less, tail, or head commands retain the color in the console? For instance, "pacman-color -Ss kde4 more" will strip all the colors.
or is there an alternative command that I may not know about that retains the colors? Below is the tail statement: tail -4 FDECMP1_$$.log I need to print the last 4 lines of file FDECMP1_$$.log in Red. I use the linux tail command to view an application log output. A lot of output is generated.
I want the tail output to display in different colors: WARN=yellow, ERROR=red I was trying to add environment variables or add to my bash script to accomplish this, but I have not found anything that will accomplish this. +1 for the function as a variable trick but this won't run head or tail on the files, it will color-cat them and only run head if the file type is unknown. I think the OP wants to run a colored head, tail etc.
Color output of linux tail command. GitHub Gist: instantly share code, notes, and snippets. Many Linux/GNU commands can output in color, but the color codes can get stripped out when piping to other commands.
I thought that it was the receiving command, such as tail, that was stripping out the color information, but it turns out it's actually the initial command, such as ls or dmesg, that is generating the color information.