Problem

  • I open the apache log (for example, using the cat ) and watch everything mixed up on the screen. This is due to the transfer of lines to put everything on one screen.

What do you need

  • disable non-wrap

Environment

  • ubuntu
  • bash
  • console (xterm driver)

What I tried

  • ... | less -RS ... | less -RS seems to solve everything, but it does not work well and it is not always possible
  • stty columns 2000 should increase the virtual size of the string, but nothing works
  • xterm +aw does exactly what you need, just disables the line feed, but you cannot make friends with the gnome / xfce terminal, any parameterization results in an error *** VTE ***: Failed to load terminal capabilities from '/etc/termcap' ( https : //bugzilla.gnome.org/show_bug.cgi? id = 640940 )

    1 answer 1

    you can use the less program, passing it the -S option ( --chop-long-lines ). So:

     $ cat file | less -S 

    or so:

     $ less -S file 

    after that, using the right / left cursor arrows, you can move the displayed text horizontally.


    By the way, this mode can be enabled / disabled directly while running the program less , by entering two -S characters and pressing enter .

    • The method is good, but you can't do it tial -f file | less -S tial -f file | less -S , and observe that less does not display colors (I guess what you need to adjust) - duhon
    • @duhon, 1. $ tail -f file | less -S $ tail -f file | less -S - works fine. 2. color is “done” by inserting special characters. the -R option is responsible for the interpretation of characters in the less program. Naturally, the "coloring" program should issue these special characters. For example: $ grep --color=always строка файл | less -R $ grep --color=always строка файл | less -R . - aleksandr barakin
    • Yes, I agree, without noticing that you need to rewind down when something is added. But there is some kind of problem, when I do until the end of that less, it hangs until I kill the process, the feeling that he is trying to find the end and hangs. - duhon
    • @duhon: you can do without tail, at the very less if you press F - there will be a mode similar to tail'u - that is, automatic output of new data when they are written to a file. This mode is disabled by Ctrl-C , while less does not close. Manual rewinding, respectively, is not necessary. - MANKK
    • in tracking mode it is not necessary to go up a couple of lines higher. If you turn off tracking, less will not close, but then again, go back to tracking without restarting less. - duhon