开发者

How do I clear the command history in the mongo shell

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜