1

I would like to clear my history in the Mongo shell (OSX/Terminal). I have tried the command 'cls' and it clears the text in the terminal. However, when I run my next query all of which I cleared reappears along with the new information from the query. How can I prevent the history from reappearing?

This question is not a possible duplicate because the answer was to use CMD+K in the mongo shell as mentioned by the accepted answer below. The suggested duplicate was unrelated.

Andrew Johnson
  • 579
  • 4
  • 23

1 Answers1

2

I think this is what you are looking for How to really clear the terminal. reset command will do the job.

Or you can try command + K button to clear scrollback buffer in OS X as mentioned here.

Community
  • 1
  • 1
m5khan
  • 2,667
  • 1
  • 27
  • 37
  • I quit the mongo shell and ran the command 'reset' and it cleared the text in the terminal. When I entered the mongo shell again and ran a query on a collection e.g. findOne, I was presented with the single object along with the entire history, so it did not work. I also tried the 'tput reset' command and still no luck. Any other suggesstions? I'd presume the command should be something ran inside the mongo shell and not outside. – Andrew Johnson Apr 21 '16 at 14:58
  • You can try `command+k` button that is used to clear scrollback buffer. If that still does not work, then try punching enter key several times will send new lines on your display, then run a mongo query. See if it works – m5khan Apr 21 '16 at 18:10
  • Pressing 'Command + K' in the mongo shell resolved the issue. Thank you for your help. – Andrew Johnson Apr 21 '16 at 23:28