In this short post you can find where it is stored and how to edit PyCharm terminal history. This is useful when you mistakenly paste huge text in your terminal. The article is written about Linux Mint but the same will apply for Ubuntu and with small changes to Windows(works for IntelliJ too).

Step 1: Locate PyCharm terminal folder

The first step is to find where is stored you terminal history of PyCharm or IntelliJ. This can be done by simple search for pattern: /JetBrains/PyCharm*/terminal/history

In Linux the command will be:

locate */terminal/history

result in:

/home/softhints/.IdeaIC2019.1/config/terminal/history
/home/softhints/.IdeaIC2019.2/config/terminal/history
/home/softhints/.IdeaIC2019.3/config/terminal/history
/home/softhints/.PyCharm2019.2/config/terminal/history
/home/softhints/.PyCharm2019.3/config/terminal/history
/home/softhints/.PyCharmCE2019.1/config/terminal/history
/home/softhints/.PyCharmCE2019.2/config/terminal/history
/home/softhints/.PyCharmCE2019.3/config/terminal/history
/home/softhints/.config/JetBrains/IdeaIC2020.1/terminal/history
/home/softhints/.config/JetBrains/IdeaIC2020.2/terminal/history
/home/softhints/.config/JetBrains/PyCharm2020.1/terminal/history
/home/softhints/.config/JetBrains/PyCharmCE2020.1/terminal/history
/home/softhints/.config/JetBrains/PyCharmCE2020.2/terminal/history

As you can see there is a difference between the version of PyCharm2019 and PyCharm2020. So you can find it manually if you know what is the version of your IDE.

Step 2: Find the last file in the PyCharm folder

Next step is to find the latest file in the folder from the previous step.
You can open it with a text editor like Sublime and edit the file.

edit-terminal-history-pycharm

Then you can edit or remove the lines. Be careful edit history file while PyCharm is closed otherwise the history might be restored from the cache!

edit-terminal-history-pycharm