2

nginx/1.17.3, GNU grep 2.27 and xterm-256color capable terminal (Xfce terminal) for some reason doesn't provide colored matches in its output. I've tried this:

  1. nginx -V | grep brotli -o --color=always -C9999
  2. nginx -V | grep -o --color=always -C9999 brotli
  3. nginx -V | grep --color=always -C9999 brotli
  4. nginx -V | grep brotli --color=always -C9999
  5. nginx -V | grep brotli -o --color=always
  6. nginx -V | grep -o --color=always brotli
  7. nginx -V | grep --color=always brotli
  8. nginx -V | grep brotli --color=always

But it simply doesn't highlight text, only meaningless wall of white text that is nginx compile options. $PS1 is colored, so terminal isn't inherently broken!

Sean
  • 6,873
  • 4
  • 21
  • 46
  • I believe you shouldn't be using profanities on this forum, even in a shortened form. Even the word "hell" would be nicer. – KamilCuk Jan 17 '20 at 17:51

1 Answers1

2

You need to redirect stderr

nginx -V 2>&1 | grep --color=always -e 'http'

Learn more about 2>&1 here: In the shell, what does " 2>&1 " mean?

0stone0
  • 34,288
  • 4
  • 39
  • 64