Is there a way to clear up what is displayed on the shell console (in ubuntu linux) in just a single key or two? When I get flood of lines from grep
and that exceeds the height of the window, I want to quickly scroll back to the position where I typed the command after the prompt. I can do so if I had opened a fresh terminal before I type the command, and just go to the initial position. But if keep using the same terminal window, I have to manually find the position. Ctrl+l
is not an answer because it just scrolls, and the contents of the terminal remains. I cannot use less
because the colored output of grep
does not show up.
If the console gets jammed/full then:
reset
will clear and reset the state. You can also cause this to be sent via the magic sequence Ctrl-v Esc c Enterclear
if you just want to clear the screen; you might combine it with the output you're after:clear ; grep -r …
(BTW,
reboot
is a separate command, so don't worry about accidentally rebooting your machine by usingclear
orreset
!).You can actually stick with using less - try this:
That will tell grep to ignore that its output is being piped, and the "-r" on less tells it to pass through raw control characters, which in this case are the color codes.