Score:1

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

bg flag

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.

Score:4
in flag

By default, systemctl spawns less as the pager (if it is available, but on most systems, it is). In this case, less is given the parameters FRSXMK, of which S is responsible for not folding long lines.

If the SYSTEMD_LESS environment variable is set, its contents are handled as the flags to be given to less, if less is the pager currently in use. So if you omit the S flag from the variable, and do an

export SYSTEMD_LESS="FRXMK"

then systemctl will behave exactly as before, except it will fold long lines.

It might be worth noting that you can switch line folding within less by typing -S and pressing enter.

Score:3
cz flag

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'
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.