OK, first of I think this is what you need: tput command. Basically it allows user to redraw the screen without closing the session. Look at the screen capture of my terminal window:
Basically, I executed command ls *.c
just to fill the screen with something. Then I execute command tput cup 4 0; echo "THIS LINE WILL BE COVERED WITH THIS ALL CAPS TEXT :)"
, and that basically places your prompt onto line 4 column 0, and executes echo to cover line 5 row 0. This will stay there even if you scroll back.
Now, suppose you just have executed the command you don't wanna user to see. So for instance, I executed iwconfig
, but do not wanna user to see my WI-FI name. I execute command and count which line it is on. In my example the wlan0 ESSID was on line 7, so I execute tput cup 6 4; echo "I DO NOT WANT USER TO SEE THIS PART"
.
Now pay attention, because this only redraws the screen! The actual command remains in the .bash_history
file. After you done with the session, you can re-open the terminal and manually delete the line you do not want. If I execute ls
command and scroll back, that part of screen is still obfuscated.
Among other things I've found, tput reset
clears screen completely, and if you wanna hide just output, pipe the output into /dev/null. For instance echo "This will never show on screen" > /dev/null
Old answer: In dropdown menu go to Edit -> Profile Preferences -> Scrolling tab.
Change number of Scrollback lines to whatever you desire. The terminal wont scroll back beyond that value of lines you entered in the terminal.
For instance, my terminal window is about 41 lines long, but since I've set it to only 10 lines of scroll back, the terminal does not scroll back at all.