36

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.

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
Kalle Richter
  • 5,935
  • 20
  • 69
  • 101

1 Answers1

51

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
kos
  • 35,535
  • 13
  • 101
  • 151
  • 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. – Kalle Richter Mar 18 '16 at 01: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 01:19
  • Is there anyway to *change* the pager to LESS? – Franklin Yu Mar 05 '17 at 04:01
  • 4
    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