10

In a long line in systemctl status it's necessary to scroll horizontally which makes it quite hard to copy the output. Is there a way to get linebreaks at the end of terminal (like nano -$ would do)?

I'm not looking for a workaround like redirecting the output into a temporary file and displaying it with an editor which supports the output.

I'm using Ubuntu 15.10.

17

You could use the --no-pager option in conjunction with the --full option, which will force the lines to wrap:

systemctl status --no-pager --full

enter image description here

If you want to preserve the paging functionality, you can just pipe the output of systemctl status to less / more directly, since connecting the command's STDOUT to a pipe will force the command to print a raw output:

systemctl status | less
  • I wonder why you didn't have to add --full to the the long line in the process tree broken. I have to do it. Thanks. – Karl Richter Mar 18 '16 at 1:06
  • @KarlRichter Sorry, failures all around tonight. I actually had to add --full, but outputting to a pipe (head) took out the need for that, and at some point I ended up thinking it just wouldn't have been useful when used in conjunction with --no-pager. You actually need --full. – kos Mar 18 '16 at 1:19
  • Is there anyway to change the pager to LESS? – Franklin Yu Mar 5 '17 at 4:01
  • 3
    yes, you van use the PAGER or the SYSTEMD_PAGER environment variables to set the pager. If you put an empty string into the environment variable then you can switch this, err, feature off. Moreover, see the SYSTEMD_LESS environment variable. – Hontvári Levente Jun 30 '17 at 14:48

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.