31

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.

35

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

| improve this answer | |
  • Nice link although I did not expect something like that to change the behavior. +1. – Luis Alvarado Oct 29 '11 at 15:59
  • 7
    Very interesting. I tried this with gnome terminal, and it sorta-kinda works, but it is also causing output to be chopped off. What I'd prefer is for the terminal to 'pretend' it had infinite line width, so it would just keep writing the line and then I could retrospectively go see the rest of the line by resizing or scrolling in the terminal window somehow. Is this possible? – wim Feb 12 '13 at 2:49
  • Does this automatically reset when a new bash/sh is made? Eg, is this, or is this not; persistent? – ThorSummoner Jul 16 '15 at 16:22
  • It is a runtime configuration of the terminal rather than a user configuration. So it won't carry over to a new terminal instance, but should carry forward to new things running in the terminal provided the behaviour isn't reset. – James Henstridge Jul 19 '15 at 13:30
  • @JamesHenstridge Is there any way to enable wrap? I don't like moving left and right to read the rest of the text on line. – Shayan Sep 22 '19 at 13:41
9

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

setterm -linewrap off

| improve this answer | |
0

Leaving aside the wrapping thing, you can zoom out/ zoom in in terminal to see all the content you need in one line.

For me is :

  • Ctrl+Shift++ - to zoom in
  • `Ctrl+- - to zoom out

Hope this helps

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.