Ubuntu – How to stop the terminal from wrapping lines

11.10gnome-terminal

Is there a way to tell the terminal not to wrap long lines. I wish to see a line in the same space without wrapping to the next one. I do not care if I can not see the end of the line just as long as the line stays in one. A horizontal scroll would be good for this also but for the moment the removal of the wrapping is what I need.

Best Answer

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