Clear a terminal screen for real

前端 未结 11 1450
悲哀的现实
悲哀的现实 2020-11-30 15:48

Using the clear command on the terminal only fools the user into thinking the screen has been cleared...you can still see output from the previous commands when

11条回答
  •  北海茫月
    2020-11-30 16:24

    I know the solution employing printing of new lines isn't much supported, but if all else fails, why not? Especially where one is operating in an environment where someone else is likely to be able to see the screen, yet not able to keylog. One potential solution then, is the following alias:

    alias c="printf '\r\n%.0s' {1..50}"
    

    Then, to "clear" away the current contents of the screen (or rather, hide them), just type c+Enter at the terminal.

提交回复
热议问题