14

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

5
  • 2
    collapse and expand how ? can you clarify ? you want to limit output to only x number of lines ? Sep 9 '16 at 23:04
  • collapse so that I don't see the output at all, only the command I typed (see update)
    – zahypeti
    Sep 10 '16 at 15:19
  • 1
    I see now, the screenshot does help to clarify. In that case, you're looking for a terminal emulator with that feature. You may or may not know that there's many terminal emulators, and up to now I've not heard of the one that has this feature. The default one in Ubuntu, the gnome-terminal is fairly simplistic and is purposely build so. You could create a feature request (bugs.launchpad.net/ubuntu/+source/gnome-terminal/+filebug) but I guarantee they won't implement it. Sep 10 '16 at 19:53
  • 2
    This feature request is already filed: bugzilla.gnome.org/show_bug.cgi?id=769420. I don't think it will be implemented in gnome-terminal in the foreseeable future, though.
    – egmont
    Sep 10 '16 at 21:07
  • I found superuser.com/questions/649884/… which mentions Final Term, but that seems dead
    – zahypeti
    Sep 18 '16 at 11:23
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.