Terminal session history #21105

Closed
opened 2026-01-31 07:33:14 +00:00 by claunia · 3 comments
Owner

Originally created by @Soneji on GitHub (Jan 18, 2024).

Description of the new feature/enhancement

As we all know, in windows, you have to restart often. When I restart my system, all my terminal panes and layout is maintained, however the content in those panes is lost.

I am proposing a feature in windows terminal to maintain this terminal history, as a bonus the session state could also be saved, e.g. the path in which the shell is currently in.

The retention of the terminal history can help me restore each pane to the correct place and easily pick up where I left off.

Is it worth noting I am using WSL 2, I am not sure if some of these features already exist with powershell.

Proposed technical implementation details (optional)

I guess there are two ways this could be implemented

  1. Save the terminal history and shell session to a temp file on shutdown
  2. Periodically save the terminal history and shell session to a temp file on the system
Originally created by @Soneji on GitHub (Jan 18, 2024). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement As we all know, in windows, you have to restart often. When I restart my system, all my terminal panes and layout is maintained, however the content in those panes is lost. I am proposing a feature in windows terminal to maintain this terminal history, as a bonus the session state could also be saved, e.g. the path in which the shell is currently in. The retention of the terminal history can help me restore each pane to the correct place and easily pick up where I left off. Is it worth noting I am using WSL 2, I am not sure if some of these features already exist with powershell. # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. --> I guess there are two ways this could be implemented 1. Save the terminal history and shell session to a temp file on shutdown 2. Periodically save the terminal history and shell session to a temp file on the system
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 07:33:14 +00:00
Author
Owner

@j4james commented on GitHub (Jan 18, 2024):

If by history you mean the buffer contents/scrollback, that feature request is tracked in issue #961.

As for saving the current directory, that should already be possible if you've configured your shell appropriately (there's a tutorial here).

@j4james commented on GitHub (Jan 18, 2024): If by history you mean the buffer contents/scrollback, that feature request is tracked in issue #961. As for saving the current directory, that should already be possible if you've configured your shell appropriately (there's a tutorial [here](https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory#configure-your-shell)).
Author
Owner

@zadjii-msft commented on GitHub (Jan 19, 2024):

Yep, that's correct. There's also the firstWindowPreference setting, to enable bringing your windows back to the right position, with the same tabs & panes. Of course, you'll also want to do the aforementioned shell integration, to let Terminal know about the CWD.

image

/dup #961 for the rest of "restore the buffer contents"

@zadjii-msft commented on GitHub (Jan 19, 2024): Yep, that's correct. There's also the [`firstWindowPreference`](https://learn.microsoft.com/en-us/windows/terminal/customize-settings/startup#behavior-when-starting-a-new-terminal-session) setting, to enable bringing your windows back to the right position, with the same tabs & panes. Of course, you'll also want to do the aforementioned shell integration, to let Terminal know about the CWD. ![image](https://github.com/microsoft/terminal/assets/18356694/0c331656-c175-4ed7-ac95-899df3d9898e) /dup #961 for the rest of "restore the buffer contents"
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Jan 19, 2024):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Jan 19, 2024): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! <!-- Policy app identification https://img.shields.io/static/v1?label=PullRequestIssueManagement. -->
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21105