This question already has an answer here:

I have a Python script which generates a lot of different text outputs that require me to clear the screen quite regularly. The problem with this is that once the script is finished, I have a terminal full of junk that I no longer need. I could just clear the terminal, but I'd prefer to have a behaviour similar to what happens when you 'watch' a command.

Watch makes it's own kind of 'sub-screen', and once you kill it you're returned to the terminal with all the displayed output from your command cleared away and your previous commands shown in the terminal. I think this is much cleaner.

Is there any way to achieve this? I'm using C shell if it's relevant but I could just as easily use bash or some other shell.

marked as duplicate by Jeff Schaller, jayhendren, mdpc, Romeo Ninov, Rui F Ribeiro Jan 17 '18 at 14:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Credit to ilkkachu for finding this

I solved the problem using the answer to this question (I've linked it below):


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