Sometimes I regret running
ls in a directory containing a lot of files because it produces too many lines in my terminal. So I'd like to be able to collapse & expand the output of each command whenever I like. This is for better readability and would (potentially) happen after the command is run.
I am not looking for suppressing / hiding the output in advance (e.g. either using redirection like
&> /dev/null or simply putting
| less at the end of my command).
I feel this could be a feature of the terminal, as it is for some text editors or IDEs. Is there one solution where I can toggle the visibility in this way?
Edit: I mean something like this:
In the wxMaxima software, the outputs are printed on the screen like this.
However, when you click on the small triangle on the left of a line, you can collapse the output temporarily and you only see the input.