Let's say I'm running a script that outputs a lot of content. Halfway through I want to clear the output so that if I scroll up, I only see output created after that point.
On Mac OS X Terminal, I can just use Command-K but there doesn't seem to be an equivalent for the Ubuntu terminal.
Here's what I've found:
clear && echo -en "\e[3]"
sends a reset and clears out the entire window, but that requires me to have access to the bash prompt- Control-L clears the current content but doesn't appear to work while a process is running and it only scrolls the window down and doesn't clear out previous content.
I'm currently using the default terminal included with the Windows subsystem Ubuntu install. Is there any command I can send to the terminal that force-resets everything?
Alternatively, is there a third-party terminal that supports this — ideally one that also offers other advantages like tabs and improved text copying/pasting?
gnome-terminal
?konsole
?xterm
? or what you see after Ctrl+Alt+F1? Anyway, after you discover what tty or pts the process uses for output (readlink /proc/<PID>/fd/1
), you can do likeclear > /dev/pts/2
from another console to affect it. This is the Unix way where "everything is a file"; I don't know if something similar works in Windows Subsystem for Linux.