1

Somehow I'm unable to get this working with color output, it works but no colors are shown.


  1. I'm currently using these alias'es in my bash shell:
    alias Xterm='xterm -geometry 132x60 +dc +cm -e '
    alias Watch='watch --color --differences --interval=1 --exec '
    alias xterm-watch='Xterm Watch '
    alias _nc='networkctl'
    alias nc-status='_nc --no-pager --stats --full status'
    alias nc-status-watch='xterm-watch nc-status'
    
  2. $TERM is set to xterm-256color
  3. When i enter nc-status-watch at the bash prompt, an xterm window pops-up correctly with a watch command running the networkctl command with it's arguments. But the output does not show any colors.

Result of nc-status-watch

How can I get colored output of systemd commands run with watch inside xterm?

2

1 Answer 1

3

Thanks to the comment from @muru, I finally got colored output.

I needed this change:

alias Xterm='SYSTEMD_COLORS=1 xterm -geometry 132x60 -e '
  • 🗒 For Wayland i also needed -rv before the -e option to reverse the fg/bg colors used by xterm.
    This is unrelated to the current topic though...
    Maybe a bug w.r.t. Wayland+xterm at moment? 🤔

Reference: How do I get systemctl to print in color when being interacted with from a non-tty?

Result of nc-status-watch with color

1

You must log in to answer this question.

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