I have a command (a compiler) that can output lots to the terminal when there's a compilation problem. Some of the lines are longer than my terminal is wide, and it also uses terminal colours (red text for errors etc). I want to run that command, and only show the first screen/page of output, but taking account of line wraps & colours.
Update I am using cargo, the Rust compiler, and if there's a syntax error, it will produce lots of output, including colours. with --colors=always, and |& I can show both. e.g. cargo build --colors=always |& head -n 20 shows the first 20 lines. I want to show the first page only, so that I can
I use entr to auto run find ./src/ -type f -name '*.rs' | entr -r bash -c 'cargo build -- color=always |& less -R will not work, because the less command gobbles everything and I can't stop it. In fact that hides all output.
lesswith-RSand scrolling horizontally with your arrow keys?yourcommand | less -RS. – Kahn Jun 23 '20 at 13:32