13
2
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
1it is not your exact answer but in such cases to view content of big files I use 'less' command instead of 'cat'. Another thing is if any command give huge number of lines as output to console you can avoid it by writing "$ the-command | less". – Devasish – 2020-01-29T11:40:26.373
Do you mean to clear the output, or to remove the command from your command history? If you want to modify your command history, maybe this thread addresses what you're looking for?
– ernie – 2013-09-24T23:40:04.920The terminal just displays a stream of text, and stores some in its own internal buffer. It has no way of knowing, or discriminating between command output. The rxvt-unicode terminal does have a perl interpreter that might be able to implement something like this. But as far as I know it's not done. – Keith – 2013-09-25T04:06:18.210
A long time ago, I used a terminal emulator on Mac OS X which had this feature, but I can't remember what it was called any more. It wasn't free, though. However, while doing a quick google search for it, I ran into http://finalterm.org, which looks like it is trying to implement that feature. However, "Final Term is in heavy development and neither stable nor feature complete!", so I didn't try it. Looks interesting, though. The google search, for what it's worth, was
– rici – 2013-09-25T04:38:43.497terminal emulator output folding
Final Term is heavily-enough developed to fold commands (and lots of other amazing stuff), and once there's a keyboard shortcut to do that then problem solved. I was beginning to think I was crazy... – nacnudus – 2013-09-25T10:50:55.810
@nacnudus: If you try it and it works for you, you should self-answer the question. That will provide guidance for other people with the same problem. – rici – 2013-09-25T15:28:37.747