0

When I SSH into a Linux machine from Windows using MobaXTerm, I get the benefit of syntax highlighting (https://mobaxterm.mobatek.net/features.html --> see Syntax highlighting in terminal). It automatically highlights keywords like error, pass, failed, missing, etc. I find this extremely useful when executing scripts that spew out a lot of debugging text -- the highlighting has helped me to notice errors that I have missed for several months due to the verbosity.

I know that programs like VIM have syntax highlighting, but it's at a program level, and is language (or file-type) specific.

I'm looking for the same highlighting as MobaXTerm, but at a Linux terminal level. Currently, I have to switch to Windows and SSH to the Linux machine just that have that feature, which is a chore. It would be nice if there is a plugin for the terminal.

Syntax highlighting in the terminal suggests few solutions, but requires the output to be piped to an external program.

  • Does it need to be perfect, or just pretty good? Do you have a list of (keyword, color) pairs? Are you prepared to have output slightly delayed, e.g if "failed" is a keyword and the program outputs "fail" and then nothing more for 30 seconds, do you want to see the word fail, which is then erased if "ed" is output and replaced with a coloured failed, or would you accept no output until it is known that the next 2 letters are "ed"? – icarus Jan 5 at 5:49
  • 1
    I'm not aware of any terminal emulator for Linux that does syntax highlighting on its own, like MobaXterm (Windows) or iTerm2 (macOS) do. There's a feature request for gnome-terminal at bugzilla.gnome.org/show_bug.cgi?id=788673 but this doesn't help you out at this moment. – egmont Jan 5 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.