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?

12

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.

1
  • 3
    cat is not necessary. It works to simply have PAGER be empty, e.g. PAGER= systemctl status ... – Michael Hampton Aug 8 '19 at 17:55

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.