Ubuntu – Gedit show text from terminal output colored

command linegeditvisualization

I run a script in terminal and the output printed in the terminal I also save in a text file. How can I display that text in Gedit colored similar to what I can see in the terminal?

I thought there could be a plugin.

Update

I might not have been as clear as I planed, so I would like to see similar coloring changes in the plain text file as appears in terminal, not for shell scripts but if I have an error message (e.g. compiler error) than those line to be differentiated from other printouts in terminal.

$ rosrun my_pkg my_node >> terminal_printout

Update 2

My gedit version is 3.10.4

ii  libgtksourceview-3.0-1:amd64   3.10.2-0ubuntu1 amd64 sared libraries for the GTK+ syntax highlighting widget
ii  libgtksourceview-3.0-common    3.10.2-0ubuntu1 all common files for the GTK+ syntax highlighting widget

Best Answer

Answer for the second version of the question

To add a highlighting for your log files, you have to write your own syntax highlighter. But that's a lot of work. Or try an existing syntax highlighter.

Open your file in gedit and click on Plain Text as you can see in the next screen shot:

    enter image description here

Predefined syntax highlighter can you find in

/usr/share/gtksourceview-3.0/

Answer for the first version of the question

A simple text (Plain Text) file hasn't a syntax highlighting in gedit

    enter image description here

Add some code in the file and save. Now the syntax highlighting for bash (sh) is active. You can see this in the status bar in the screen shot below

    enter image description here

The colours of a shell script in a terminal is possible with escape sequences, see the next screen shots

    enter image description here

    enter image description here

As you can see, those are completely different things. In gedit you have colours via syntax highlighting and in a terminal with escape sequences.

Related Question