Howto wrap long lines in PuTTY's output

This is a very small tweak, but is very convenient

When a command is issued in PuTTY, the long lines of output are truncated at right edge of putty. This sometimes is annoying. Please see “Screenshot 1 of 2” below

If the command is issued with | tee /dev/null (or simply |tee ) at its end, it causes output lines to wrap, and makes full output visible. Please see “Screenshot 2 of 2” below.

Screenshot 1 of 2

 

Screenshot 2 of 2

 

2 Likes

That is called a pipe command using the vertical bar, sends the output of one command into another command.

VERY useful and thanks for the reminder!

It’s not PuTTY that’s ‘chopping’ off the end of long lines - journalctl by itself displays the line with horizontal scroll meaning that you can scroll to the right (using right arrow key) to see the stuff beyond the highlighted “>” mark. Oddly enough journalctl -fu piaware (follow the journal for id piaware live as it happens) does indeed wrap long lines without the horizontal scroll.

Your solution ( pipe to tee ) is one of many ways to see the whole line wrapped on the screen. Other ways might include:
journalctl -u piaware -n 10 --no-pager
journalctl -u piaware -n 10 | less

2 Likes

@AhrBee

With both the “systemctl status” and “journalctl -u” commands, pressing arrow key shows only 2nd part of the line. Pressing arrow key again shows the 3rd part of line. It does NOT show the complete line at once. For reading the output it is OK, but if you want co copy-paste the whole output somewhere, for example a forum post, it wont succeed.

For “journalctl -u”, the "-f " or “--no-pager” do wrap the lines.

For “systemctl status” command the "-f " OR “--no-pager” option does not work. The only way I found by trial & error is to add “| tee /dev/null” or "| tee " at the end of “systemctl status” command. Adding “| less” also works same way.

The systemctl options --no-pager --full will wrap output lines. Example command:

systemctl status piaware.service --no-pager --full

The systemctl command hints at that if you leave out --full and use only --no-pager with the message:
Hint: Some lines were ellipsized, use -l to show in full.

2 Likes

@AhrBee

Thank you for informing about “--no-pager --full” for systemctl command. I was not aware of it.

However the undocumented “|tee” is a bit shorter, so easier to type.

2 Likes