in linux console, how to NOT wrap output

In a (linux) terminal, sometimes it is less important to see line endings, but more important not to clutter the line startings. e.g.

line1 sddd dd ddd
line2 sdafss ss s
line 3 da aaaa aa 

rather than

line1 sddd dd ddd
dd dddd dd
line2 sdafss ss s
s ss
line 3 da aaaa aa 

is there a way to "cut" or "hide" line ending at the end of the terminal's window, in the same manner as "less -S" does, but for kind-of-normal output?


Solution 1:

Line wrap disabling support is terminal dependent. For example if using screen you can hit Ctrl-A Ctrl-R to toggle line wrap.

Otherwise, you might try setterm -linewrap off with or without increasing the number of terminal columns with stty (haven't tried this).

Terminal emulators like PuTTY (if you connect to the server from a Windows box) have their own settings.

If the terminal supports VT escape codes, echo -ne "\x1b[7l" will disable screen wrap (echo -ne "\x1b[7h" will enable it).

Notice that what works in one terminal might not work in another - for example I'm now on a PuTTY window on a Linux OpenSuSE 12.3 with bash, using screen: its control sequence works perfectly, while VT codes and term do not. On a text-mode console on a older SuSE 11 (not GUI), the VT sequence works (probably screen would, too), stty is apparently ignored.