How to stop the terminal from wrapping lines

Solution 1:

It depends on what application you are using.

If you are viewing a file or command output using less, passing the -S option (a.k.a. --chop-long-lines) will cause output to be chopped off rather than wrapping to a new line. You can use the horizontal arrow keys to view the rest of the line.

For generic non full screen applications, you can turn off line wrapping by sending an appropriate escape sequence to the terminal:

tput rmam

This mode can be cancelled with a similar escape:

tput smam

Details on adjusting the behaviour for a few other command line tools can be found here:

http://tomayko.com/writings/StupidShellTricks

Solution 2:

To disable line wrapping in terminal more generally, you can use:

setterm -linewrap off