Linux – Clear terminal output of last command only

bashlinuxterminalUbuntu

Rather than scroll past hundreds of lines of output to see the previous command history, can the output of the last command be cleared? E.g. after executing ls, clear its output because you don't need it any more.

EDIT:

This is not your usual clear or ctrl+L operation. The idea is to scroll back though the history looking for the output of a previous command, but without having to have to scroll past a load of ls, or cat, or sudo apt-get install output unless I really want to. It might look something like this:

cat fileIWantToRemember
ls directoryIWantToForget
# some command that wipes the output of ls
# scroll back to see the output of cat immediately

Best Answer

With thanks to @rici, this behaviour can be called "folding". The output of commands isn't forgotten, but you can hide it until you need it again. Folding is common in text editors but seems to be rare in terminal emulators.

Final Term is a new terminal emulator that includes folding among many other fancy tricks. Beware: "Final Term is in heavy development and neither stable nor feature complete!" It was heavily-enough developed to fold my commands when I tested it, but too unstable not to crash. One to watch.