Today I was using
glance tool in my office to monitor CPU utilization.When I run
glance from terminal ,the command clears the screen and after all the work when I quit back to the terminal,the previous prompts are still there on my screen.I mean that I can see all the previous lines.My question is how is this effect of clearing screen achieved.If they had used command like
clear,It should have cleared the whole screen,how did they manage to get back all the previous prompts ? I want to implement the same feature for some of my scripts.
Similarly when using
vi command ,the screen is fully occupied and after exiting,we are able to view previous prompts as well.