开发者

How do I clear the command history in the mongo shell

开发者 https://www.devze.com 2023-02-07 02:13 出处:网络
Is there a command to clear the history from wit开发者_Python百科hin the mongo shell?There should be a file called .dbshell in your home folder. Just delete it.MongoDB terminal history is stored insid

Is there a command to clear the history from wit开发者_Python百科hin the mongo shell?


There should be a file called .dbshell in your home folder. Just delete it.


MongoDB terminal history is stored inside the ~/.dbshellfile. Just empty the .dbshell file

 $ > ~/.dbshell

Versions of Windows mongo.exe earlier than 2.2.0 will save the .dbshell file in the mongo.exe working directory.


You can clear contents on the shell by Ctrl + L


Command history is stored in ~/.dbshell file.

For example, on a Unix-like system:

# Ensure an empty history file
echo "" > ~/.dbshell

# Remove rwx access to the history file
chmod 0 ~/.dbshell


If you're using MongoDB Shell as a standalone package, you will find the shell history file located in ~/.dbshell

If you're using the embedded MongoDB Shell inside MongoDB Compass, you will find the shell history file located in ~/.config/MongoDB Compass/MongoDB Compass/shell-history.json

Just empty the history file

0

精彩评论

暂无评论...
验证码 换一张
取 消