How to disable line wrap in a terminal? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionWhat is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?tmux equivalent to GNU screen's :wrap modeMove to the beginning of a line in screenWho does the linewrap and how to deactivate?Dynamic text wrapping of terminal outputNon-printing escape sequence: when?How are long command lines ( > $COLUMNS ) automatically wrapped to a new line?Background color whitespace when end of the terminal reachedEliminating trailing space on wrapped lines in a terminalHow to have type-ahead apply to bash history search (Ctrl-R)?Terminal doesn't wrap properlyshow escape sequences in terminal?

What is the largest species of polychaete?

Active filter with series inductor and resistor - do these exist?

How to colour the US map with Yellow, Green, Red and Blue to minimize the number of states with the colour of Green

Who can trigger ship-wide alerts in Star Trek?

Interesting examples of non-locally compact topological groups

Antler Helmet: Can it work?

Why use gamma over alpha radiation?

What do you call a plan that's an alternative plan in case your initial plan fails?

What would be Julian Assange's expected punishment, on the current English criminal law?

Losing the Initialization Vector in Cipher Block Chaining

Strange behaviour of Check

How does modal jazz use chord progressions?

How are presidential pardons supposed to be used?

Is there a documented rationale why the House Ways and Means chairman can demand tax info?

What is the electric potential inside a point charge?

What's the difference between (size_t)-1 and ~0?

Why does this iterative way of solving of equation work?

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Estimated State payment too big --> money back; + 2018 Tax Reform

What are the performance impacts of 'functional' Rust?

Should you tell Jews they are breaking a commandment?

Single author papers against my advisor's will?

Statistical model of ligand substitution

How do you clear the ApexPages.getMessages() collection in a test?



How to disable line wrap in a terminal?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionWhat is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?tmux equivalent to GNU screen's :wrap modeMove to the beginning of a line in screenWho does the linewrap and how to deactivate?Dynamic text wrapping of terminal outputNon-printing escape sequence: when?How are long command lines ( > $COLUMNS ) automatically wrapped to a new line?Background color whitespace when end of the terminal reachedEliminating trailing space on wrapped lines in a terminalHow to have type-ahead apply to bash history search (Ctrl-R)?Terminal doesn't wrap properlyshow escape sequences in terminal?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








45















I need to view large logs files using a bash shell. I was using less to open the files, but since the lines are too lengthy there is some kind of line/word wrapping going on.



Since the files are Log4J logs, and there is a pattern in the beginning of each line, having lines wrapped makes it difficult to analyze the output, so I started using less -S which chops long lines.



But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?



Note: there is an answer to a different question that mentions the escape sequence echo -ne 'e[?7l', but it seems to not work on bash.










share|improve this question



















  • 4





    Note that this is unrelated to your choice of shell (bash), but it can depend on your choice of terminal (xterm, Terminal, gnome-terminal, konsole, …). See What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

    – Gilles
    Sep 11 '11 at 18:16






  • 4





    As Gilles mentioned, it is a matter of the terminal emulator. For example, in screen, there is a "wrap" command. In xterm, there is a -aw option to prevent automatic line wraps. Likely there are some X resources for other terminal emulators. What emulator are you using?

    – Arcege
    Sep 12 '11 at 20:04











  • I am using gnome-terminal.

    – nunaxe
    Sep 17 '11 at 8:53






  • 1





    @Arcege: Actually, it is +aw for xterm :) But, this solves the issue for output (e.g., on ls -l with a bunch on long Windows-ish names from TPB, it works fine), for input, when entering a command, you probably still want wrap (or, at least you don't want it the way it is now on +aw: try write beyond the "column border" and then backtrack for a huge GFX bug).

    – Emanuel Berg
    Nov 9 '12 at 23:37











  • By the way, it seems neither urxvt nor rxvt can disable line wraps.

    – Emanuel Berg
    Nov 9 '12 at 23:50

















45















I need to view large logs files using a bash shell. I was using less to open the files, but since the lines are too lengthy there is some kind of line/word wrapping going on.



Since the files are Log4J logs, and there is a pattern in the beginning of each line, having lines wrapped makes it difficult to analyze the output, so I started using less -S which chops long lines.



But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?



Note: there is an answer to a different question that mentions the escape sequence echo -ne 'e[?7l', but it seems to not work on bash.










share|improve this question



















  • 4





    Note that this is unrelated to your choice of shell (bash), but it can depend on your choice of terminal (xterm, Terminal, gnome-terminal, konsole, …). See What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

    – Gilles
    Sep 11 '11 at 18:16






  • 4





    As Gilles mentioned, it is a matter of the terminal emulator. For example, in screen, there is a "wrap" command. In xterm, there is a -aw option to prevent automatic line wraps. Likely there are some X resources for other terminal emulators. What emulator are you using?

    – Arcege
    Sep 12 '11 at 20:04











  • I am using gnome-terminal.

    – nunaxe
    Sep 17 '11 at 8:53






  • 1





    @Arcege: Actually, it is +aw for xterm :) But, this solves the issue for output (e.g., on ls -l with a bunch on long Windows-ish names from TPB, it works fine), for input, when entering a command, you probably still want wrap (or, at least you don't want it the way it is now on +aw: try write beyond the "column border" and then backtrack for a huge GFX bug).

    – Emanuel Berg
    Nov 9 '12 at 23:37











  • By the way, it seems neither urxvt nor rxvt can disable line wraps.

    – Emanuel Berg
    Nov 9 '12 at 23:50













45












45








45


7






I need to view large logs files using a bash shell. I was using less to open the files, but since the lines are too lengthy there is some kind of line/word wrapping going on.



Since the files are Log4J logs, and there is a pattern in the beginning of each line, having lines wrapped makes it difficult to analyze the output, so I started using less -S which chops long lines.



But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?



Note: there is an answer to a different question that mentions the escape sequence echo -ne 'e[?7l', but it seems to not work on bash.










share|improve this question
















I need to view large logs files using a bash shell. I was using less to open the files, but since the lines are too lengthy there is some kind of line/word wrapping going on.



Since the files are Log4J logs, and there is a pattern in the beginning of each line, having lines wrapped makes it difficult to analyze the output, so I started using less -S which chops long lines.



But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?



Note: there is an answer to a different question that mentions the escape sequence echo -ne 'e[?7l', but it seems to not work on bash.







terminal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 11 '11 at 18:14









Gilles

548k13011131631




548k13011131631










asked Sep 11 '11 at 9:39









nunaxenunaxe

363146




363146







  • 4





    Note that this is unrelated to your choice of shell (bash), but it can depend on your choice of terminal (xterm, Terminal, gnome-terminal, konsole, …). See What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

    – Gilles
    Sep 11 '11 at 18:16






  • 4





    As Gilles mentioned, it is a matter of the terminal emulator. For example, in screen, there is a "wrap" command. In xterm, there is a -aw option to prevent automatic line wraps. Likely there are some X resources for other terminal emulators. What emulator are you using?

    – Arcege
    Sep 12 '11 at 20:04











  • I am using gnome-terminal.

    – nunaxe
    Sep 17 '11 at 8:53






  • 1





    @Arcege: Actually, it is +aw for xterm :) But, this solves the issue for output (e.g., on ls -l with a bunch on long Windows-ish names from TPB, it works fine), for input, when entering a command, you probably still want wrap (or, at least you don't want it the way it is now on +aw: try write beyond the "column border" and then backtrack for a huge GFX bug).

    – Emanuel Berg
    Nov 9 '12 at 23:37











  • By the way, it seems neither urxvt nor rxvt can disable line wraps.

    – Emanuel Berg
    Nov 9 '12 at 23:50












  • 4





    Note that this is unrelated to your choice of shell (bash), but it can depend on your choice of terminal (xterm, Terminal, gnome-terminal, konsole, …). See What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

    – Gilles
    Sep 11 '11 at 18:16






  • 4





    As Gilles mentioned, it is a matter of the terminal emulator. For example, in screen, there is a "wrap" command. In xterm, there is a -aw option to prevent automatic line wraps. Likely there are some X resources for other terminal emulators. What emulator are you using?

    – Arcege
    Sep 12 '11 at 20:04











  • I am using gnome-terminal.

    – nunaxe
    Sep 17 '11 at 8:53






  • 1





    @Arcege: Actually, it is +aw for xterm :) But, this solves the issue for output (e.g., on ls -l with a bunch on long Windows-ish names from TPB, it works fine), for input, when entering a command, you probably still want wrap (or, at least you don't want it the way it is now on +aw: try write beyond the "column border" and then backtrack for a huge GFX bug).

    – Emanuel Berg
    Nov 9 '12 at 23:37











  • By the way, it seems neither urxvt nor rxvt can disable line wraps.

    – Emanuel Berg
    Nov 9 '12 at 23:50







4




4





Note that this is unrelated to your choice of shell (bash), but it can depend on your choice of terminal (xterm, Terminal, gnome-terminal, konsole, …). See What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

– Gilles
Sep 11 '11 at 18:16





Note that this is unrelated to your choice of shell (bash), but it can depend on your choice of terminal (xterm, Terminal, gnome-terminal, konsole, …). See What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

– Gilles
Sep 11 '11 at 18:16




4




4





As Gilles mentioned, it is a matter of the terminal emulator. For example, in screen, there is a "wrap" command. In xterm, there is a -aw option to prevent automatic line wraps. Likely there are some X resources for other terminal emulators. What emulator are you using?

– Arcege
Sep 12 '11 at 20:04





As Gilles mentioned, it is a matter of the terminal emulator. For example, in screen, there is a "wrap" command. In xterm, there is a -aw option to prevent automatic line wraps. Likely there are some X resources for other terminal emulators. What emulator are you using?

– Arcege
Sep 12 '11 at 20:04













I am using gnome-terminal.

– nunaxe
Sep 17 '11 at 8:53





I am using gnome-terminal.

– nunaxe
Sep 17 '11 at 8:53




1




1





@Arcege: Actually, it is +aw for xterm :) But, this solves the issue for output (e.g., on ls -l with a bunch on long Windows-ish names from TPB, it works fine), for input, when entering a command, you probably still want wrap (or, at least you don't want it the way it is now on +aw: try write beyond the "column border" and then backtrack for a huge GFX bug).

– Emanuel Berg
Nov 9 '12 at 23:37





@Arcege: Actually, it is +aw for xterm :) But, this solves the issue for output (e.g., on ls -l with a bunch on long Windows-ish names from TPB, it works fine), for input, when entering a command, you probably still want wrap (or, at least you don't want it the way it is now on +aw: try write beyond the "column border" and then backtrack for a huge GFX bug).

– Emanuel Berg
Nov 9 '12 at 23:37













By the way, it seems neither urxvt nor rxvt can disable line wraps.

– Emanuel Berg
Nov 9 '12 at 23:50





By the way, it seems neither urxvt nor rxvt can disable line wraps.

– Emanuel Berg
Nov 9 '12 at 23:50










11 Answers
11






active

oldest

votes


















6














Do you actually need tail -f or would something like less +F do? Since it sounds like you still want an interactive pager, it seems to me it would be much easier to stick with less than to reimplement one yourself.



A final note: have you considered tail -f file | less?






share|improve this answer























  • I made some experiences with screen and xterm as those emulators have options to prevent line wraps. But there is a big difference between truncating the line and hiding the tail of the line so we can view it if we want. Using tail -f file | less -S is not perfect as it seems to disable the -f but it is the best solution I found.

    – nunaxe
    Sep 17 '11 at 8:56












  • @Boris Marcos 's answer is perhaps better. It uses less directly.

    – AnthonyD973
    Mar 18 at 21:55


















48














Try:



less -S +F filename



  • Press Ctrlc to stop tailing and now You can move left and right using cursor keys.

  • Press Shiftf to resume tailing

  • Press Ctrlc, q to quit





share|improve this answer

























  • This is great! Been having my terminal span two screens, but since I read this yesterday I just pipe the wide output to less -S. Also very useful on the laptop.

    – Jonatan Öström
    Dec 16 '18 at 12:41



















12














Supposing you have the COLUMNS variable defined, you can execute



tail -f your-app.log | cut -c -$COLUMNS


otherwise substitute $COLUMNS with the columns width of the terminal, as obtained by stty -a.






share|improve this answer


















  • 2





    Another alternative to $COLUMNS (is not immediately updated on SIGWINCH, only on the next prompt) and stty -a (harder to use in script) is tput cols.

    – manatwork
    Sep 11 '11 at 12:43











  • Thanks enzotib. That works, but it trims the line and we are unable to see the end of the long lines. Is is possible to make cut behave like less -S where the long line are buffered and we are able to see the complete line using the directional keys?

    – nunaxe
    Sep 11 '11 at 15:12











  • Uhm, not that simple. I'm thinking of wired solutions as e.g. two separate screen windows each with a tail -f | cut or a script emulating in some way the less behavior. But do not have a solution, at the moment.

    – enzotib
    Sep 11 '11 at 16:16







  • 1





    Side-note: cut only counts bytes; unlike less -S, it's going to screw up on coloured text, or anything with ANSI escapes. Might screw up Unicode too.

    – ELLIOTTCABLE
    Jun 8 '13 at 20:39











  • Yes, less -S is more useful with colored text. You can use less -S -E to exit immediately - useful for cutting colored output at $COLUMNS.

    – blueyed
    May 13 '15 at 16:42



















8














Finally found a good answer from superuser, that works out of the box for gnome-terminal, and probably for other terminals as well:



setterm -linewrap off


enter image description here






share|improve this answer
































    4














    The terminator (http://software.jessies.org/terminator/) terminal emulator allow to not wrap long lines and has horizontal scrolling (but is written in Java).






    share|improve this answer























    • How do I enable it? It doesn't seem to work by default.

      – defhlt
      Aug 29 '12 at 13:26











    • As of this writing, horizontal scroll is on by default. Great, cross-platform recommendation. Thanks!

      – user7089
      Jan 26 '13 at 0:18











    • Please make this answer better by showing how one would enable this feature. I've searched in Preferences and can't seem to locate this option. FWIW, I'm running terminator v1.91.

      – AnthonyK
      Jan 18 at 23:28











    • @AnthonyK There are two unrelated terminal emulators sharing the name terminator, this one which gentledevil is referring to and that one which you are using.

      – jlliagre
      Feb 11 at 1:06


















    2














    Two good answers/examples here



    http://www.commandlinefu.com/commands/view/1710/tail-a-log-file-with-long-lines-truncated



    tail -f logfile.log | cut -b 1-80

    tail -f logfile.log | cut -b -$(tput cols)


    One caveat: at least on the built in terminal on my Mac cut does not seem to handle tab characters very well. It seems it displays them with e.g., 8 spaces but just calculates them as 4 space wide or something like that. In other words, if your terminal is 80 characters wide and your output contains several tabs per line you must set the width to maybe 60 or something like that. YMMV.






    share|improve this answer






























      1














      Use below options with less. It will disable word wrap and preserve text colors, if specified.

      less -SR +F filename






      share|improve this answer






























        1














        There are a lot of comments which stray from the question. OP's question was




        But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?




        Some comments were made about the autowrap feature, stating that not all terminals have it. Perhaps. But (aside from terminator, whose developers document no terminal description) all of the examples given were xterm, rxvt and some look-alike or descendent. Those are all related.



        The +aw option in xterm corresponds to the autoWrap resource. Consulting the manual, it says that



         autoWrap (class AutoWrap)
        Specifies whether or not auto-wraparound should be enabled.
        This is the same as the VT102 DECAWM. The default is "true".


        and in XTerm Control Sequences it says



        CSI ? Pm h
        ...
        DEC Private Mode Set (DECSET).
        Ps = 7 -> Wraparound Mode (DECAWM).


        which certainly does not "depend on your choice of terminal", since any terminal with VT100-compatibility supports the feature. xterm and rxvt do this, for example. The others do as well.



        Whether the feature would be useful to OP is debatable. Suppressing line-wrapping is only one aspect of the problem:



        • The shell knows the width of the terminal—but that can be overridden by setting COLUMNS to a "large" value.

        • Of course that means that applications will spend a lot of time writing on the right-margin (and some, getting it wrong, will start a new line anyway).

        • OP probably assumed that the application would scroll left/right to make the wide terminal usable. (terminator does this — partly — but its other drawbacks cancel that out, except for those who only use the terminal for cat'ing a logfile to the screen).

        • what OP actually is looking for is a set of tools that can be told to disable line-wrap, especially for viewing logfiles. If the terminal works well enough for general use, it is irrelevant to the choice of tools which one uses within the terminal.

        There are pagers which can do what is needed, e.g., multitail which lists in its features




        Line wrapping can be switched off, after that one can scroll to the left/right with the cursor keys




        Being ncurses-based, it should work on any of the cited terminals.






        share|improve this answer






























          1














          There are a few examples on this page piping tail with -f ... from my tests it doesn't work properly, if you really need piping (eg. if you need to pipe something more, like grep) you may use something like:



          watch -n 1 'tail -n $(($LINES-3)) file.log | cut -c -$COLUMNS'


          not the best for performance probably but works... else if no extra pipping required you may use something different like:



          less -S +F file.log





          share|improve this answer
































            0














            vi



            inside vi type



            :set nowrap


            I beleive there is also a plugin for vi that will give you tail like behaviour.






            share|improve this answer






























              -1














              If you really want to see the full lines you can copy and paste the text into a text editor like Atom or Notepad++ and disable line wraps in there.






              share|improve this answer























                Your Answer








                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "106"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                draft saved

                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f20493%2fhow-to-disable-line-wrap-in-a-terminal%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                11 Answers
                11






                active

                oldest

                votes








                11 Answers
                11






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                6














                Do you actually need tail -f or would something like less +F do? Since it sounds like you still want an interactive pager, it seems to me it would be much easier to stick with less than to reimplement one yourself.



                A final note: have you considered tail -f file | less?






                share|improve this answer























                • I made some experiences with screen and xterm as those emulators have options to prevent line wraps. But there is a big difference between truncating the line and hiding the tail of the line so we can view it if we want. Using tail -f file | less -S is not perfect as it seems to disable the -f but it is the best solution I found.

                  – nunaxe
                  Sep 17 '11 at 8:56












                • @Boris Marcos 's answer is perhaps better. It uses less directly.

                  – AnthonyD973
                  Mar 18 at 21:55















                6














                Do you actually need tail -f or would something like less +F do? Since it sounds like you still want an interactive pager, it seems to me it would be much easier to stick with less than to reimplement one yourself.



                A final note: have you considered tail -f file | less?






                share|improve this answer























                • I made some experiences with screen and xterm as those emulators have options to prevent line wraps. But there is a big difference between truncating the line and hiding the tail of the line so we can view it if we want. Using tail -f file | less -S is not perfect as it seems to disable the -f but it is the best solution I found.

                  – nunaxe
                  Sep 17 '11 at 8:56












                • @Boris Marcos 's answer is perhaps better. It uses less directly.

                  – AnthonyD973
                  Mar 18 at 21:55













                6












                6








                6







                Do you actually need tail -f or would something like less +F do? Since it sounds like you still want an interactive pager, it seems to me it would be much easier to stick with less than to reimplement one yourself.



                A final note: have you considered tail -f file | less?






                share|improve this answer













                Do you actually need tail -f or would something like less +F do? Since it sounds like you still want an interactive pager, it seems to me it would be much easier to stick with less than to reimplement one yourself.



                A final note: have you considered tail -f file | less?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 11 '11 at 17:20









                jw013jw013

                37k7102125




                37k7102125












                • I made some experiences with screen and xterm as those emulators have options to prevent line wraps. But there is a big difference between truncating the line and hiding the tail of the line so we can view it if we want. Using tail -f file | less -S is not perfect as it seems to disable the -f but it is the best solution I found.

                  – nunaxe
                  Sep 17 '11 at 8:56












                • @Boris Marcos 's answer is perhaps better. It uses less directly.

                  – AnthonyD973
                  Mar 18 at 21:55

















                • I made some experiences with screen and xterm as those emulators have options to prevent line wraps. But there is a big difference between truncating the line and hiding the tail of the line so we can view it if we want. Using tail -f file | less -S is not perfect as it seems to disable the -f but it is the best solution I found.

                  – nunaxe
                  Sep 17 '11 at 8:56












                • @Boris Marcos 's answer is perhaps better. It uses less directly.

                  – AnthonyD973
                  Mar 18 at 21:55
















                I made some experiences with screen and xterm as those emulators have options to prevent line wraps. But there is a big difference between truncating the line and hiding the tail of the line so we can view it if we want. Using tail -f file | less -S is not perfect as it seems to disable the -f but it is the best solution I found.

                – nunaxe
                Sep 17 '11 at 8:56






                I made some experiences with screen and xterm as those emulators have options to prevent line wraps. But there is a big difference between truncating the line and hiding the tail of the line so we can view it if we want. Using tail -f file | less -S is not perfect as it seems to disable the -f but it is the best solution I found.

                – nunaxe
                Sep 17 '11 at 8:56














                @Boris Marcos 's answer is perhaps better. It uses less directly.

                – AnthonyD973
                Mar 18 at 21:55





                @Boris Marcos 's answer is perhaps better. It uses less directly.

                – AnthonyD973
                Mar 18 at 21:55













                48














                Try:



                less -S +F filename



                • Press Ctrlc to stop tailing and now You can move left and right using cursor keys.

                • Press Shiftf to resume tailing

                • Press Ctrlc, q to quit





                share|improve this answer

























                • This is great! Been having my terminal span two screens, but since I read this yesterday I just pipe the wide output to less -S. Also very useful on the laptop.

                  – Jonatan Öström
                  Dec 16 '18 at 12:41
















                48














                Try:



                less -S +F filename



                • Press Ctrlc to stop tailing and now You can move left and right using cursor keys.

                • Press Shiftf to resume tailing

                • Press Ctrlc, q to quit





                share|improve this answer

























                • This is great! Been having my terminal span two screens, but since I read this yesterday I just pipe the wide output to less -S. Also very useful on the laptop.

                  – Jonatan Öström
                  Dec 16 '18 at 12:41














                48












                48








                48







                Try:



                less -S +F filename



                • Press Ctrlc to stop tailing and now You can move left and right using cursor keys.

                • Press Shiftf to resume tailing

                • Press Ctrlc, q to quit





                share|improve this answer















                Try:



                less -S +F filename



                • Press Ctrlc to stop tailing and now You can move left and right using cursor keys.

                • Press Shiftf to resume tailing

                • Press Ctrlc, q to quit






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 13 '12 at 17:41









                jasonwryan

                50.9k14135190




                50.9k14135190










                answered Dec 13 '12 at 9:59









                Boris MarcosBoris Marcos

                59143




                59143












                • This is great! Been having my terminal span two screens, but since I read this yesterday I just pipe the wide output to less -S. Also very useful on the laptop.

                  – Jonatan Öström
                  Dec 16 '18 at 12:41


















                • This is great! Been having my terminal span two screens, but since I read this yesterday I just pipe the wide output to less -S. Also very useful on the laptop.

                  – Jonatan Öström
                  Dec 16 '18 at 12:41

















                This is great! Been having my terminal span two screens, but since I read this yesterday I just pipe the wide output to less -S. Also very useful on the laptop.

                – Jonatan Öström
                Dec 16 '18 at 12:41






                This is great! Been having my terminal span two screens, but since I read this yesterday I just pipe the wide output to less -S. Also very useful on the laptop.

                – Jonatan Öström
                Dec 16 '18 at 12:41












                12














                Supposing you have the COLUMNS variable defined, you can execute



                tail -f your-app.log | cut -c -$COLUMNS


                otherwise substitute $COLUMNS with the columns width of the terminal, as obtained by stty -a.






                share|improve this answer


















                • 2





                  Another alternative to $COLUMNS (is not immediately updated on SIGWINCH, only on the next prompt) and stty -a (harder to use in script) is tput cols.

                  – manatwork
                  Sep 11 '11 at 12:43











                • Thanks enzotib. That works, but it trims the line and we are unable to see the end of the long lines. Is is possible to make cut behave like less -S where the long line are buffered and we are able to see the complete line using the directional keys?

                  – nunaxe
                  Sep 11 '11 at 15:12











                • Uhm, not that simple. I'm thinking of wired solutions as e.g. two separate screen windows each with a tail -f | cut or a script emulating in some way the less behavior. But do not have a solution, at the moment.

                  – enzotib
                  Sep 11 '11 at 16:16







                • 1





                  Side-note: cut only counts bytes; unlike less -S, it's going to screw up on coloured text, or anything with ANSI escapes. Might screw up Unicode too.

                  – ELLIOTTCABLE
                  Jun 8 '13 at 20:39











                • Yes, less -S is more useful with colored text. You can use less -S -E to exit immediately - useful for cutting colored output at $COLUMNS.

                  – blueyed
                  May 13 '15 at 16:42
















                12














                Supposing you have the COLUMNS variable defined, you can execute



                tail -f your-app.log | cut -c -$COLUMNS


                otherwise substitute $COLUMNS with the columns width of the terminal, as obtained by stty -a.






                share|improve this answer


















                • 2





                  Another alternative to $COLUMNS (is not immediately updated on SIGWINCH, only on the next prompt) and stty -a (harder to use in script) is tput cols.

                  – manatwork
                  Sep 11 '11 at 12:43











                • Thanks enzotib. That works, but it trims the line and we are unable to see the end of the long lines. Is is possible to make cut behave like less -S where the long line are buffered and we are able to see the complete line using the directional keys?

                  – nunaxe
                  Sep 11 '11 at 15:12











                • Uhm, not that simple. I'm thinking of wired solutions as e.g. two separate screen windows each with a tail -f | cut or a script emulating in some way the less behavior. But do not have a solution, at the moment.

                  – enzotib
                  Sep 11 '11 at 16:16







                • 1





                  Side-note: cut only counts bytes; unlike less -S, it's going to screw up on coloured text, or anything with ANSI escapes. Might screw up Unicode too.

                  – ELLIOTTCABLE
                  Jun 8 '13 at 20:39











                • Yes, less -S is more useful with colored text. You can use less -S -E to exit immediately - useful for cutting colored output at $COLUMNS.

                  – blueyed
                  May 13 '15 at 16:42














                12












                12








                12







                Supposing you have the COLUMNS variable defined, you can execute



                tail -f your-app.log | cut -c -$COLUMNS


                otherwise substitute $COLUMNS with the columns width of the terminal, as obtained by stty -a.






                share|improve this answer













                Supposing you have the COLUMNS variable defined, you can execute



                tail -f your-app.log | cut -c -$COLUMNS


                otherwise substitute $COLUMNS with the columns width of the terminal, as obtained by stty -a.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 11 '11 at 11:22









                enzotibenzotib

                34.7k810495




                34.7k810495







                • 2





                  Another alternative to $COLUMNS (is not immediately updated on SIGWINCH, only on the next prompt) and stty -a (harder to use in script) is tput cols.

                  – manatwork
                  Sep 11 '11 at 12:43











                • Thanks enzotib. That works, but it trims the line and we are unable to see the end of the long lines. Is is possible to make cut behave like less -S where the long line are buffered and we are able to see the complete line using the directional keys?

                  – nunaxe
                  Sep 11 '11 at 15:12











                • Uhm, not that simple. I'm thinking of wired solutions as e.g. two separate screen windows each with a tail -f | cut or a script emulating in some way the less behavior. But do not have a solution, at the moment.

                  – enzotib
                  Sep 11 '11 at 16:16







                • 1





                  Side-note: cut only counts bytes; unlike less -S, it's going to screw up on coloured text, or anything with ANSI escapes. Might screw up Unicode too.

                  – ELLIOTTCABLE
                  Jun 8 '13 at 20:39











                • Yes, less -S is more useful with colored text. You can use less -S -E to exit immediately - useful for cutting colored output at $COLUMNS.

                  – blueyed
                  May 13 '15 at 16:42













                • 2





                  Another alternative to $COLUMNS (is not immediately updated on SIGWINCH, only on the next prompt) and stty -a (harder to use in script) is tput cols.

                  – manatwork
                  Sep 11 '11 at 12:43











                • Thanks enzotib. That works, but it trims the line and we are unable to see the end of the long lines. Is is possible to make cut behave like less -S where the long line are buffered and we are able to see the complete line using the directional keys?

                  – nunaxe
                  Sep 11 '11 at 15:12











                • Uhm, not that simple. I'm thinking of wired solutions as e.g. two separate screen windows each with a tail -f | cut or a script emulating in some way the less behavior. But do not have a solution, at the moment.

                  – enzotib
                  Sep 11 '11 at 16:16







                • 1





                  Side-note: cut only counts bytes; unlike less -S, it's going to screw up on coloured text, or anything with ANSI escapes. Might screw up Unicode too.

                  – ELLIOTTCABLE
                  Jun 8 '13 at 20:39











                • Yes, less -S is more useful with colored text. You can use less -S -E to exit immediately - useful for cutting colored output at $COLUMNS.

                  – blueyed
                  May 13 '15 at 16:42








                2




                2





                Another alternative to $COLUMNS (is not immediately updated on SIGWINCH, only on the next prompt) and stty -a (harder to use in script) is tput cols.

                – manatwork
                Sep 11 '11 at 12:43





                Another alternative to $COLUMNS (is not immediately updated on SIGWINCH, only on the next prompt) and stty -a (harder to use in script) is tput cols.

                – manatwork
                Sep 11 '11 at 12:43













                Thanks enzotib. That works, but it trims the line and we are unable to see the end of the long lines. Is is possible to make cut behave like less -S where the long line are buffered and we are able to see the complete line using the directional keys?

                – nunaxe
                Sep 11 '11 at 15:12





                Thanks enzotib. That works, but it trims the line and we are unable to see the end of the long lines. Is is possible to make cut behave like less -S where the long line are buffered and we are able to see the complete line using the directional keys?

                – nunaxe
                Sep 11 '11 at 15:12













                Uhm, not that simple. I'm thinking of wired solutions as e.g. two separate screen windows each with a tail -f | cut or a script emulating in some way the less behavior. But do not have a solution, at the moment.

                – enzotib
                Sep 11 '11 at 16:16






                Uhm, not that simple. I'm thinking of wired solutions as e.g. two separate screen windows each with a tail -f | cut or a script emulating in some way the less behavior. But do not have a solution, at the moment.

                – enzotib
                Sep 11 '11 at 16:16





                1




                1





                Side-note: cut only counts bytes; unlike less -S, it's going to screw up on coloured text, or anything with ANSI escapes. Might screw up Unicode too.

                – ELLIOTTCABLE
                Jun 8 '13 at 20:39





                Side-note: cut only counts bytes; unlike less -S, it's going to screw up on coloured text, or anything with ANSI escapes. Might screw up Unicode too.

                – ELLIOTTCABLE
                Jun 8 '13 at 20:39













                Yes, less -S is more useful with colored text. You can use less -S -E to exit immediately - useful for cutting colored output at $COLUMNS.

                – blueyed
                May 13 '15 at 16:42






                Yes, less -S is more useful with colored text. You can use less -S -E to exit immediately - useful for cutting colored output at $COLUMNS.

                – blueyed
                May 13 '15 at 16:42












                8














                Finally found a good answer from superuser, that works out of the box for gnome-terminal, and probably for other terminals as well:



                setterm -linewrap off


                enter image description here






                share|improve this answer





























                  8














                  Finally found a good answer from superuser, that works out of the box for gnome-terminal, and probably for other terminals as well:



                  setterm -linewrap off


                  enter image description here






                  share|improve this answer



























                    8












                    8








                    8







                    Finally found a good answer from superuser, that works out of the box for gnome-terminal, and probably for other terminals as well:



                    setterm -linewrap off


                    enter image description here






                    share|improve this answer















                    Finally found a good answer from superuser, that works out of the box for gnome-terminal, and probably for other terminals as well:



                    setterm -linewrap off


                    enter image description here







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 20 '17 at 10:04









                    Community

                    1




                    1










                    answered Feb 16 '17 at 15:12









                    Yuri GhensevYuri Ghensev

                    18113




                    18113





















                        4














                        The terminator (http://software.jessies.org/terminator/) terminal emulator allow to not wrap long lines and has horizontal scrolling (but is written in Java).






                        share|improve this answer























                        • How do I enable it? It doesn't seem to work by default.

                          – defhlt
                          Aug 29 '12 at 13:26











                        • As of this writing, horizontal scroll is on by default. Great, cross-platform recommendation. Thanks!

                          – user7089
                          Jan 26 '13 at 0:18











                        • Please make this answer better by showing how one would enable this feature. I've searched in Preferences and can't seem to locate this option. FWIW, I'm running terminator v1.91.

                          – AnthonyK
                          Jan 18 at 23:28











                        • @AnthonyK There are two unrelated terminal emulators sharing the name terminator, this one which gentledevil is referring to and that one which you are using.

                          – jlliagre
                          Feb 11 at 1:06















                        4














                        The terminator (http://software.jessies.org/terminator/) terminal emulator allow to not wrap long lines and has horizontal scrolling (but is written in Java).






                        share|improve this answer























                        • How do I enable it? It doesn't seem to work by default.

                          – defhlt
                          Aug 29 '12 at 13:26











                        • As of this writing, horizontal scroll is on by default. Great, cross-platform recommendation. Thanks!

                          – user7089
                          Jan 26 '13 at 0:18











                        • Please make this answer better by showing how one would enable this feature. I've searched in Preferences and can't seem to locate this option. FWIW, I'm running terminator v1.91.

                          – AnthonyK
                          Jan 18 at 23:28











                        • @AnthonyK There are two unrelated terminal emulators sharing the name terminator, this one which gentledevil is referring to and that one which you are using.

                          – jlliagre
                          Feb 11 at 1:06













                        4












                        4








                        4







                        The terminator (http://software.jessies.org/terminator/) terminal emulator allow to not wrap long lines and has horizontal scrolling (but is written in Java).






                        share|improve this answer













                        The terminator (http://software.jessies.org/terminator/) terminal emulator allow to not wrap long lines and has horizontal scrolling (but is written in Java).







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Sep 12 '11 at 16:46









                        gentledevilgentledevil

                        27413




                        27413












                        • How do I enable it? It doesn't seem to work by default.

                          – defhlt
                          Aug 29 '12 at 13:26











                        • As of this writing, horizontal scroll is on by default. Great, cross-platform recommendation. Thanks!

                          – user7089
                          Jan 26 '13 at 0:18











                        • Please make this answer better by showing how one would enable this feature. I've searched in Preferences and can't seem to locate this option. FWIW, I'm running terminator v1.91.

                          – AnthonyK
                          Jan 18 at 23:28











                        • @AnthonyK There are two unrelated terminal emulators sharing the name terminator, this one which gentledevil is referring to and that one which you are using.

                          – jlliagre
                          Feb 11 at 1:06

















                        • How do I enable it? It doesn't seem to work by default.

                          – defhlt
                          Aug 29 '12 at 13:26











                        • As of this writing, horizontal scroll is on by default. Great, cross-platform recommendation. Thanks!

                          – user7089
                          Jan 26 '13 at 0:18











                        • Please make this answer better by showing how one would enable this feature. I've searched in Preferences and can't seem to locate this option. FWIW, I'm running terminator v1.91.

                          – AnthonyK
                          Jan 18 at 23:28











                        • @AnthonyK There are two unrelated terminal emulators sharing the name terminator, this one which gentledevil is referring to and that one which you are using.

                          – jlliagre
                          Feb 11 at 1:06
















                        How do I enable it? It doesn't seem to work by default.

                        – defhlt
                        Aug 29 '12 at 13:26





                        How do I enable it? It doesn't seem to work by default.

                        – defhlt
                        Aug 29 '12 at 13:26













                        As of this writing, horizontal scroll is on by default. Great, cross-platform recommendation. Thanks!

                        – user7089
                        Jan 26 '13 at 0:18





                        As of this writing, horizontal scroll is on by default. Great, cross-platform recommendation. Thanks!

                        – user7089
                        Jan 26 '13 at 0:18













                        Please make this answer better by showing how one would enable this feature. I've searched in Preferences and can't seem to locate this option. FWIW, I'm running terminator v1.91.

                        – AnthonyK
                        Jan 18 at 23:28





                        Please make this answer better by showing how one would enable this feature. I've searched in Preferences and can't seem to locate this option. FWIW, I'm running terminator v1.91.

                        – AnthonyK
                        Jan 18 at 23:28













                        @AnthonyK There are two unrelated terminal emulators sharing the name terminator, this one which gentledevil is referring to and that one which you are using.

                        – jlliagre
                        Feb 11 at 1:06





                        @AnthonyK There are two unrelated terminal emulators sharing the name terminator, this one which gentledevil is referring to and that one which you are using.

                        – jlliagre
                        Feb 11 at 1:06











                        2














                        Two good answers/examples here



                        http://www.commandlinefu.com/commands/view/1710/tail-a-log-file-with-long-lines-truncated



                        tail -f logfile.log | cut -b 1-80

                        tail -f logfile.log | cut -b -$(tput cols)


                        One caveat: at least on the built in terminal on my Mac cut does not seem to handle tab characters very well. It seems it displays them with e.g., 8 spaces but just calculates them as 4 space wide or something like that. In other words, if your terminal is 80 characters wide and your output contains several tabs per line you must set the width to maybe 60 or something like that. YMMV.






                        share|improve this answer



























                          2














                          Two good answers/examples here



                          http://www.commandlinefu.com/commands/view/1710/tail-a-log-file-with-long-lines-truncated



                          tail -f logfile.log | cut -b 1-80

                          tail -f logfile.log | cut -b -$(tput cols)


                          One caveat: at least on the built in terminal on my Mac cut does not seem to handle tab characters very well. It seems it displays them with e.g., 8 spaces but just calculates them as 4 space wide or something like that. In other words, if your terminal is 80 characters wide and your output contains several tabs per line you must set the width to maybe 60 or something like that. YMMV.






                          share|improve this answer

























                            2












                            2








                            2







                            Two good answers/examples here



                            http://www.commandlinefu.com/commands/view/1710/tail-a-log-file-with-long-lines-truncated



                            tail -f logfile.log | cut -b 1-80

                            tail -f logfile.log | cut -b -$(tput cols)


                            One caveat: at least on the built in terminal on my Mac cut does not seem to handle tab characters very well. It seems it displays them with e.g., 8 spaces but just calculates them as 4 space wide or something like that. In other words, if your terminal is 80 characters wide and your output contains several tabs per line you must set the width to maybe 60 or something like that. YMMV.






                            share|improve this answer













                            Two good answers/examples here



                            http://www.commandlinefu.com/commands/view/1710/tail-a-log-file-with-long-lines-truncated



                            tail -f logfile.log | cut -b 1-80

                            tail -f logfile.log | cut -b -$(tput cols)


                            One caveat: at least on the built in terminal on my Mac cut does not seem to handle tab characters very well. It seems it displays them with e.g., 8 spaces but just calculates them as 4 space wide or something like that. In other words, if your terminal is 80 characters wide and your output contains several tabs per line you must set the width to maybe 60 or something like that. YMMV.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 18 '14 at 12:59









                            d-bd-b

                            97878




                            97878





















                                1














                                Use below options with less. It will disable word wrap and preserve text colors, if specified.

                                less -SR +F filename






                                share|improve this answer



























                                  1














                                  Use below options with less. It will disable word wrap and preserve text colors, if specified.

                                  less -SR +F filename






                                  share|improve this answer

























                                    1












                                    1








                                    1







                                    Use below options with less. It will disable word wrap and preserve text colors, if specified.

                                    less -SR +F filename






                                    share|improve this answer













                                    Use below options with less. It will disable word wrap and preserve text colors, if specified.

                                    less -SR +F filename







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Mar 17 '16 at 10:45









                                    Kamal NayanKamal Nayan

                                    1237




                                    1237





















                                        1














                                        There are a lot of comments which stray from the question. OP's question was




                                        But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?




                                        Some comments were made about the autowrap feature, stating that not all terminals have it. Perhaps. But (aside from terminator, whose developers document no terminal description) all of the examples given were xterm, rxvt and some look-alike or descendent. Those are all related.



                                        The +aw option in xterm corresponds to the autoWrap resource. Consulting the manual, it says that



                                         autoWrap (class AutoWrap)
                                        Specifies whether or not auto-wraparound should be enabled.
                                        This is the same as the VT102 DECAWM. The default is "true".


                                        and in XTerm Control Sequences it says



                                        CSI ? Pm h
                                        ...
                                        DEC Private Mode Set (DECSET).
                                        Ps = 7 -> Wraparound Mode (DECAWM).


                                        which certainly does not "depend on your choice of terminal", since any terminal with VT100-compatibility supports the feature. xterm and rxvt do this, for example. The others do as well.



                                        Whether the feature would be useful to OP is debatable. Suppressing line-wrapping is only one aspect of the problem:



                                        • The shell knows the width of the terminal—but that can be overridden by setting COLUMNS to a "large" value.

                                        • Of course that means that applications will spend a lot of time writing on the right-margin (and some, getting it wrong, will start a new line anyway).

                                        • OP probably assumed that the application would scroll left/right to make the wide terminal usable. (terminator does this — partly — but its other drawbacks cancel that out, except for those who only use the terminal for cat'ing a logfile to the screen).

                                        • what OP actually is looking for is a set of tools that can be told to disable line-wrap, especially for viewing logfiles. If the terminal works well enough for general use, it is irrelevant to the choice of tools which one uses within the terminal.

                                        There are pagers which can do what is needed, e.g., multitail which lists in its features




                                        Line wrapping can be switched off, after that one can scroll to the left/right with the cursor keys




                                        Being ncurses-based, it should work on any of the cited terminals.






                                        share|improve this answer



























                                          1














                                          There are a lot of comments which stray from the question. OP's question was




                                          But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?




                                          Some comments were made about the autowrap feature, stating that not all terminals have it. Perhaps. But (aside from terminator, whose developers document no terminal description) all of the examples given were xterm, rxvt and some look-alike or descendent. Those are all related.



                                          The +aw option in xterm corresponds to the autoWrap resource. Consulting the manual, it says that



                                           autoWrap (class AutoWrap)
                                          Specifies whether or not auto-wraparound should be enabled.
                                          This is the same as the VT102 DECAWM. The default is "true".


                                          and in XTerm Control Sequences it says



                                          CSI ? Pm h
                                          ...
                                          DEC Private Mode Set (DECSET).
                                          Ps = 7 -> Wraparound Mode (DECAWM).


                                          which certainly does not "depend on your choice of terminal", since any terminal with VT100-compatibility supports the feature. xterm and rxvt do this, for example. The others do as well.



                                          Whether the feature would be useful to OP is debatable. Suppressing line-wrapping is only one aspect of the problem:



                                          • The shell knows the width of the terminal—but that can be overridden by setting COLUMNS to a "large" value.

                                          • Of course that means that applications will spend a lot of time writing on the right-margin (and some, getting it wrong, will start a new line anyway).

                                          • OP probably assumed that the application would scroll left/right to make the wide terminal usable. (terminator does this — partly — but its other drawbacks cancel that out, except for those who only use the terminal for cat'ing a logfile to the screen).

                                          • what OP actually is looking for is a set of tools that can be told to disable line-wrap, especially for viewing logfiles. If the terminal works well enough for general use, it is irrelevant to the choice of tools which one uses within the terminal.

                                          There are pagers which can do what is needed, e.g., multitail which lists in its features




                                          Line wrapping can be switched off, after that one can scroll to the left/right with the cursor keys




                                          Being ncurses-based, it should work on any of the cited terminals.






                                          share|improve this answer

























                                            1












                                            1








                                            1







                                            There are a lot of comments which stray from the question. OP's question was




                                            But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?




                                            Some comments were made about the autowrap feature, stating that not all terminals have it. Perhaps. But (aside from terminator, whose developers document no terminal description) all of the examples given were xterm, rxvt and some look-alike or descendent. Those are all related.



                                            The +aw option in xterm corresponds to the autoWrap resource. Consulting the manual, it says that



                                             autoWrap (class AutoWrap)
                                            Specifies whether or not auto-wraparound should be enabled.
                                            This is the same as the VT102 DECAWM. The default is "true".


                                            and in XTerm Control Sequences it says



                                            CSI ? Pm h
                                            ...
                                            DEC Private Mode Set (DECSET).
                                            Ps = 7 -> Wraparound Mode (DECAWM).


                                            which certainly does not "depend on your choice of terminal", since any terminal with VT100-compatibility supports the feature. xterm and rxvt do this, for example. The others do as well.



                                            Whether the feature would be useful to OP is debatable. Suppressing line-wrapping is only one aspect of the problem:



                                            • The shell knows the width of the terminal—but that can be overridden by setting COLUMNS to a "large" value.

                                            • Of course that means that applications will spend a lot of time writing on the right-margin (and some, getting it wrong, will start a new line anyway).

                                            • OP probably assumed that the application would scroll left/right to make the wide terminal usable. (terminator does this — partly — but its other drawbacks cancel that out, except for those who only use the terminal for cat'ing a logfile to the screen).

                                            • what OP actually is looking for is a set of tools that can be told to disable line-wrap, especially for viewing logfiles. If the terminal works well enough for general use, it is irrelevant to the choice of tools which one uses within the terminal.

                                            There are pagers which can do what is needed, e.g., multitail which lists in its features




                                            Line wrapping can be switched off, after that one can scroll to the left/right with the cursor keys




                                            Being ncurses-based, it should work on any of the cited terminals.






                                            share|improve this answer













                                            There are a lot of comments which stray from the question. OP's question was




                                            But now I need to use tail -f, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?




                                            Some comments were made about the autowrap feature, stating that not all terminals have it. Perhaps. But (aside from terminator, whose developers document no terminal description) all of the examples given were xterm, rxvt and some look-alike or descendent. Those are all related.



                                            The +aw option in xterm corresponds to the autoWrap resource. Consulting the manual, it says that



                                             autoWrap (class AutoWrap)
                                            Specifies whether or not auto-wraparound should be enabled.
                                            This is the same as the VT102 DECAWM. The default is "true".


                                            and in XTerm Control Sequences it says



                                            CSI ? Pm h
                                            ...
                                            DEC Private Mode Set (DECSET).
                                            Ps = 7 -> Wraparound Mode (DECAWM).


                                            which certainly does not "depend on your choice of terminal", since any terminal with VT100-compatibility supports the feature. xterm and rxvt do this, for example. The others do as well.



                                            Whether the feature would be useful to OP is debatable. Suppressing line-wrapping is only one aspect of the problem:



                                            • The shell knows the width of the terminal—but that can be overridden by setting COLUMNS to a "large" value.

                                            • Of course that means that applications will spend a lot of time writing on the right-margin (and some, getting it wrong, will start a new line anyway).

                                            • OP probably assumed that the application would scroll left/right to make the wide terminal usable. (terminator does this — partly — but its other drawbacks cancel that out, except for those who only use the terminal for cat'ing a logfile to the screen).

                                            • what OP actually is looking for is a set of tools that can be told to disable line-wrap, especially for viewing logfiles. If the terminal works well enough for general use, it is irrelevant to the choice of tools which one uses within the terminal.

                                            There are pagers which can do what is needed, e.g., multitail which lists in its features




                                            Line wrapping can be switched off, after that one can scroll to the left/right with the cursor keys




                                            Being ncurses-based, it should work on any of the cited terminals.







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Mar 17 '16 at 22:37









                                            Thomas DickeyThomas Dickey

                                            54.3k5106181




                                            54.3k5106181





















                                                1














                                                There are a few examples on this page piping tail with -f ... from my tests it doesn't work properly, if you really need piping (eg. if you need to pipe something more, like grep) you may use something like:



                                                watch -n 1 'tail -n $(($LINES-3)) file.log | cut -c -$COLUMNS'


                                                not the best for performance probably but works... else if no extra pipping required you may use something different like:



                                                less -S +F file.log





                                                share|improve this answer





























                                                  1














                                                  There are a few examples on this page piping tail with -f ... from my tests it doesn't work properly, if you really need piping (eg. if you need to pipe something more, like grep) you may use something like:



                                                  watch -n 1 'tail -n $(($LINES-3)) file.log | cut -c -$COLUMNS'


                                                  not the best for performance probably but works... else if no extra pipping required you may use something different like:



                                                  less -S +F file.log





                                                  share|improve this answer



























                                                    1












                                                    1








                                                    1







                                                    There are a few examples on this page piping tail with -f ... from my tests it doesn't work properly, if you really need piping (eg. if you need to pipe something more, like grep) you may use something like:



                                                    watch -n 1 'tail -n $(($LINES-3)) file.log | cut -c -$COLUMNS'


                                                    not the best for performance probably but works... else if no extra pipping required you may use something different like:



                                                    less -S +F file.log





                                                    share|improve this answer















                                                    There are a few examples on this page piping tail with -f ... from my tests it doesn't work properly, if you really need piping (eg. if you need to pipe something more, like grep) you may use something like:



                                                    watch -n 1 'tail -n $(($LINES-3)) file.log | cut -c -$COLUMNS'


                                                    not the best for performance probably but works... else if no extra pipping required you may use something different like:



                                                    less -S +F file.log






                                                    share|improve this answer














                                                    share|improve this answer



                                                    share|improve this answer








                                                    edited Apr 10 at 20:40

























                                                    answered Jul 16 '17 at 22:05









                                                    narsnars

                                                    1113




                                                    1113





















                                                        0














                                                        vi



                                                        inside vi type



                                                        :set nowrap


                                                        I beleive there is also a plugin for vi that will give you tail like behaviour.






                                                        share|improve this answer



























                                                          0














                                                          vi



                                                          inside vi type



                                                          :set nowrap


                                                          I beleive there is also a plugin for vi that will give you tail like behaviour.






                                                          share|improve this answer

























                                                            0












                                                            0








                                                            0







                                                            vi



                                                            inside vi type



                                                            :set nowrap


                                                            I beleive there is also a plugin for vi that will give you tail like behaviour.






                                                            share|improve this answer













                                                            vi



                                                            inside vi type



                                                            :set nowrap


                                                            I beleive there is also a plugin for vi that will give you tail like behaviour.







                                                            share|improve this answer












                                                            share|improve this answer



                                                            share|improve this answer










                                                            answered Sep 6 '18 at 6:10









                                                            JacquesJacques

                                                            1




                                                            1





















                                                                -1














                                                                If you really want to see the full lines you can copy and paste the text into a text editor like Atom or Notepad++ and disable line wraps in there.






                                                                share|improve this answer



























                                                                  -1














                                                                  If you really want to see the full lines you can copy and paste the text into a text editor like Atom or Notepad++ and disable line wraps in there.






                                                                  share|improve this answer

























                                                                    -1












                                                                    -1








                                                                    -1







                                                                    If you really want to see the full lines you can copy and paste the text into a text editor like Atom or Notepad++ and disable line wraps in there.






                                                                    share|improve this answer













                                                                    If you really want to see the full lines you can copy and paste the text into a text editor like Atom or Notepad++ and disable line wraps in there.







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Jul 14 '16 at 23:55









                                                                    James HeazlewoodJames Heazlewood

                                                                    1




                                                                    1



























                                                                        draft saved

                                                                        draft discarded
















































                                                                        Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                                                        • Please be sure to answer the question. Provide details and share your research!

                                                                        But avoid


                                                                        • Asking for help, clarification, or responding to other answers.

                                                                        • Making statements based on opinion; back them up with references or personal experience.

                                                                        To learn more, see our tips on writing great answers.




                                                                        draft saved


                                                                        draft discarded














                                                                        StackExchange.ready(
                                                                        function ()
                                                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f20493%2fhow-to-disable-line-wrap-in-a-terminal%23new-answer', 'question_page');

                                                                        );

                                                                        Post as a guest















                                                                        Required, but never shown





















































                                                                        Required, but never shown














                                                                        Required, but never shown












                                                                        Required, but never shown







                                                                        Required, but never shown

































                                                                        Required, but never shown














                                                                        Required, but never shown












                                                                        Required, but never shown







                                                                        Required, but never shown







                                                                        Popular posts from this blog

                                                                        getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                                                                        Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                                                                        Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.