make systemd pager not do horizontal scroll, and wrap to next line instead

Rory asked:

By default systemd (v245) on Ubuntu 20.04 focal, if I do systemctl status $THING, and the output lines are longer than my screen, then the default pager (less?) will do horizontal scrolling. I would rather the extra text be on the following lines ("word wrap")

what environmental variable can I set to make this change from horizontal scrolling to "put the remainder of the line on the next line"?

I know that systemctl --no-pager $THING or systemctl status $THING | cat will work in this case, but that’s extra text to type every time. I want systemctl status $THING to always work without having to add extra bits.

My answer:


You can make no-pager permanent by exporting an empty environment variable SYSTEMD_PAGER, i.e.:

export SYSTEMD_PAGER=

But you will notice that now systemd ellipsizes the long lines, so you must also turn this off with the -l, --full command line option. There’s no environment variable to change this, unfortunately.


For a complete solution I would suggest a shell alias for systemctl, such as:

alias systemctl='systemctl --no-pager --full'

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.