Did terminal used to remember the last directory?


I feel like my terminal tabs used to startup in the same directory that they were in when I closed IntelliJ. Now existing terminal tabs always start in the project root. Is there a way to activate this feature? Am I crazy and this behavior never existed?


Hi Tiagocpeixoto I've reproduced the problem and raised a new issue in YouTrack. Please follow https://youtrack.jetbrains.com/issue/IDEA-272699 , for updates.


In my case, using Windows 10, this only happens when I'm using PowerShell (shell path = pwsh). When using cmd (shell path = cmd), paths are saved as expected, but not when using PowerShell.


Terminal should remember working directory and history. This has been implemented in 2018.3: https://youtrack.jetbrains.com/issue/IDEA-117946

This is working like that: 

1. In .idea/workspace.xml file of the project there is a project ID

2. File with the name equal to project ID exists in IDE settings directory

3. In the file from (2) there is a node with "TerminalArrangementManager" name where all the information regarding opened tabs and working directories is being saved. 


I have started experiencing this behaviour with 2021.1 EAP.  The directory is not getting persisted.  This was one of my absolute favorite features; I hope it is fixed soon.


After doing a little bit of experimentation, there is 1 terminal tab in 1 of my projects that remembers its last directory (out of 2 projects and about 6 tabs) ¯\_(ツ)_/¯


I believe you're right. I usually have one tab open to the root level of my project, one to where I can ng serve, and another to run Gradle commands. I usually can start a project up and those tabs are restored. However, having major issues with IntelliJ even loading my project modules back in correctly so I can't really test it for you :(


Konstantin Annikov
Thank you for putting that screenshot together. I finally got around to looking into this today. Unfortunately, this does not yield many clues about this behavior.

For me, the "currentWorkingDirectory" is not being saved on the TerminalTabState attributes. My file looks like this:

<component name="TerminalArrangementManager">
<option name="myTabStates">
<TerminalTabState tabName="Local" commandHistoryFileName="history-1095" />

This results in the terminal tab opening to the project home directory when the IDE starts. I tried deleting the TerminalTabState entries that were there previously. The above snippet is the result after starting the IDE again and navigating to a new directory. When I close and reopen the IDE, the terminal is back to the project directory.

Do you know why this is happening?


What shell/bash is in use? 

May you share the screenshot of this settings page: 


Please follow the related issue: https://youtrack.jetbrains.com/issue/IDEA-258522

We couldn't reproduce it locally yet. 


Stale thanks - just hit this issue renaming things.  Thanks Konstantin Annikov for the perfect answer, super easy to follow, fixed my issue.


Please sign in to leave a comment.