1

Is there a way to customize ubuntu terminal in such a way that output of the any command is colorized according to some patterns. In .bashrc I can customize prompt, but I am looking for something similar to what MobaXTerm does on windows: when I cat file and there is some specific word, like false, error or failure it is colored red. Words: success, true are colored green. It really helps reading logs, configurations etc. Is there a way to achieve this in terminal?

1
  • 2
    Do You have some specific tool in mind ? I think most of the linux tools have some option to enable colored output. If not You can use alternate tool. Instead of cat You can use bat, instead of ls You can use exa and so on... Aug 20, 2019 at 21:45

1 Answer 1

1

You could use colorizer tools, see e.g. https://superuser.com/q/602294.

I'm not aware of any terminal emulator for Linux that offers such coloring (syntax highlighting) on its own. If there exists one, someone will sure correct me.

There's a proof of concept patch for VTE with hardwired words, you can modify them or add new ones by changing the source. VTE is used by several terminal emulators, including e.g. GNOME Terminal, Tilix or Xfce Terminal; thus if you patch, compile and install VTE, you can use this feature in any of these.

Your Answer

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

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