If I open a man page of a program like
ls, it prints (may not be the appropriate word) the contents of the man page and when I press
q, it shows the screen just like before invoking the
man command. How does the restore happen? What erases everything and then prints the previous contents of the shell?
[VAR121@Tesla Testing]$ man ls
LS(1) User Commands LS(1) NAME ls - list directory contents SYNOPSIS ls [OPTION]... [FILE]... ............
When I press
q, the screen goes back to shells default appearance, such as the prompt shown below.
[VAR121@Tesla Testing]$ man ls [VAR121@Tesla Testing]$
How is the screen restored ?