Ubuntu – Terminal emulator that has “code folding”

command lineconsolegnome-terminaloutputxterm

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.

expanded

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.

collapsed

Best Answer

I have being looking for this feature for years as but I am afraid to say that at this moment there is no usable terminal that implements this feature.

I read that there were plans to add it to iTerm2 but that moment is still on wishlist.