I am actually making a menu for my official server. I made it through bash scripting on AIX. The problem i am facing is that when script is running, user can scroll up and see history of all commands he used/entered etc. Even though i clear the screen but scrolling up still shows the previous commands. Is there any way that i can permanently clear the screen so that even scrolling up cannot show anything.

  • tput reset ; history -c – GypsyCosmonaut Mar 25 at 6:33
  • 2
    Are you talking about the command line history, the command line prompt, or the terminal's scroll back buffer? – Kusalananda Mar 25 at 6:39
  • That's not about which shell you use (shells don't have screens or scrollback buffers) but which terminal or terminal emulator you use. Which is it? xterm, aixterm, GNU screen, gnome-terminal? – Stéphane Chazelas Mar 25 at 6:58
  • With xterm, printf '\33[3J would clear the scrollback buffer. On my system, tput clear sends \033[3J\033[H\033[2J. With gnome-terminal, I need printf '\e[H\e[2J\e[3J' to properly wipe everything. With GNU screen, you'd probably need to set the scrollback length to 0 temporarily: screen -X scrollback 0... – Stéphane Chazelas Mar 25 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.