41

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
  • 119,820

1 Answers1

56

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
  • 41,378
  • 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
  • Works for RHEL 8 as well. – Ivan Chau Mar 19 '25 at 06:37
  • To avoid typing this entire line each time, I added the line alias status='systemctl status --no-pager -l' to my ~/.bash_aliases file (you can create this file if it doesn't exist on your system). After sourcing the file with $ source ~/.bash_aliases, you can use $ sudo status apache2.service (for instance) to get sensible output with less to remember. – Borea Deitz Sep 27 '25 at 13:21