5

When I run systemctl status with multiple services at once like

sudo systemctl status myservice1 myservice2 myservice3 I see the output, but in the end I see

lines 1-48/48 (END) or if the output is even larger with more arguments

lines 1-62 and I can scroll or paginate the output and quit with q.

Can this behavior be changed that all log output is printed at once and the command exits?

exeral
  • 1,787
  • 11
  • 21
lamviec
  • 51
  • 1

2 Answers2

13

Two options:

  • PAGER=cat systemctl status service1 service2 service3
  • systemctl --no-pager status service1 service2 service3

Explanation:

Those lines 1-62 messages are produced by a pager program, the commonly used ones are more and less. Pager programs intend to make output more user-friendly, scrollable, etc. They are especially important on less feature-rich terminal emulators.

The pager program to use is controlled by PAGER environment variable. By setting PAGER to cat we replace fancier more or less with a much more simple pager which actually does not do any paging.

Alternative is to pass --no-pager to systemctl which tells it not to invoke pager program at all.

rvs
  • 4,125
  • 1
  • 27
  • 31
0

In my case, providing environment variable PAGER or the option --no-pager messed up my terminal display (with weird dots display):

systemctl status --no-pager suricata

So, I just use this way:

sudo systemctl status myservice1 myservice2 myservice3 | cat

MaXi32
  • 367
  • 2
  • 11