3

I frequently SSH into remote ubuntu servers to observe output.

What I'd like is certain terms (e.g. ERROR) to be colorized, (e.g. in red).

My understanding is that this is typically done by the shell, not the terminal. I do NOT want to change/install anything on remote servers however. I'd like this to be done at the terminal level, so that it would work on my local or remote box.

On Windows, some terminals support this, e.g. Mobaxterm.

mobaxterm

So I'm looking for something equivalent in Linux land.

6
  • 1
    +1 for mentioning Mobaxterm. I too have had this dilemma.. nothing on Linux seems to be able to do what MobaXTerm can do.. but in this case, I bet someone will know how to pull THIS off. Commented Oct 18, 2021 at 12:39
  • Yip be hard to imagine Windows having the edge on something terminal related!
    – Nik
    Commented Oct 18, 2021 at 17:43
  • The closest I can find is Hyper.is. It looks like maybe one could write a plugin for this, to highlight terms. But would rather have something a) out of the box, and b) not Electron based
    – Nik
    Commented Oct 24, 2021 at 8:38
  • 1
    There's a proof of concept, abandoned work for VTE (the engine behind GNOME Terminal, Tilix, Terminator, Xfce4 Terminal, Guake and many others) at gitlab.gnome.org/GNOME/gnome-terminal/-/issues/7771. The highlighting rules are hardcoded in the patch, you have to change them there and recompile. I don't know how hard it is to apply the patch to current VTE, or perhaps you can use an older version from around the time when the patch was created. No regex support yet, just plain string match. But if you don't mind this amount of inconvenience then the patch is believed to work reliably.
    – egmont
    Commented Sep 21, 2023 at 6:34
  • 1
    (con't) I've tried and the patch still applies, just one trivial conflict to manually resolve. I recommend to start from the VTE version and patches shipped by your distro (assuming that it's not older than the patch, i.e. 0.58.0 or newer). After compiling, give it a test run with ./src/app/vte-2.91. If satisfied, install it system-wide, then restart your choice of VTE-based emulator (quit all its windows at once). Should you mess up this installation, undo it and reinstall your distro packages from a non-VTE-terminal (e.g. xterm or console). Good luck! :)
    – egmont
    Commented Sep 21, 2023 at 6:57

2 Answers 2

0

You could pipe your command to grep with color:

your-command | grep -E --color 'pattern|$'

This needs to be done per command though.


You can apply this for the whole shell, by making the your-command the shell itself:

bash | grep -E --color 'pattern|$'

enter image description here

1
  • Thanks Gauthier, but doing it per command is not going to work. And, making changes to the shell itself is also a no go. I want this at the terminal level, transparently, to every machine I connect to, without any other changes (like Mobaxterm)
    – Nik
    Commented Oct 21, 2021 at 13:32
0

I think the less-standard terminal commands in Linux like Terminator and Terminology do the trick? See This list.

1
  • Thanks, I've looked at most (all?) of those, and some are great, but not found the feature I'm looking for.
    – Nik
    Commented Oct 27, 2021 at 22:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .