Recent commands UI #19307

Closed
opened 2026-01-31 06:39:36 +00:00 by claunia · 2 comments
Owner

Originally created by @KyodaiKen on GitHub (Feb 3, 2023).

Description of the new feature/enhancement

In Linux, almost every terminal stores a persistent history of commands. I think in this case it's the interpreter like bash or zsh. But I think it should be possible to do it on app level per user as well.

Proposed technical implementation details (optional)

A simple SQLite DB file per user and per command interpreter (cmd, powershell, etc.) that stores the history of commands could be used. The location should be configurable in the preferences JSON.

  1. User enters:

    backup f: n:\backups\computername\system
    format f:
    
  2. User closes terminal and maybe even reboots windows

  3. User opens terminal back up and can push the arrow up key to recall the last commands they have executed.

  4. User cannot find what they're searching for, so they type:

    history
    

    And sees a list like this:

    0 2022-02-03 14:33: backup f: n:\backups\computername\system
    1 2022-02-03 14:43: format f:
    

    And can redo the command using !1 or !0.
    With #0 the line pops up to be edited before executing with the RETURN key

Originally created by @KyodaiKen on GitHub (Feb 3, 2023). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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 In Linux, almost every terminal stores a persistent history of commands. I think in this case it's the interpreter like `bash` or `zsh`. But I think it should be possible to do it on app level per user as well. <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation details (optional) A simple SQLite DB file per user and per command interpreter (cmd, powershell, etc.) that stores the history of commands could be used. The location should be configurable in the preferences JSON. <!-- A clear and concise description of what you want to happen. --> 1. User enters: ``` backup f: n:\backups\computername\system format f: ``` 2. User closes terminal and maybe even reboots windows 3. User opens terminal back up and can push the arrow up key to recall the last commands they have executed. 4. User cannot find what they're searching for, so they type: ``` history ``` And sees a list like this: ``` 0 2022-02-03 14:33: backup f: n:\backups\computername\system 1 2022-02-03 14:43: format f: ``` And can redo the command using `!1` or `!0`. With `#0` the line pops up to be edited before executing with the `RETURN` key
claunia added the Area-SettingsIssue-TaskIn-PRNeeds-Tag-FixProduct-Terminal labels 2026-01-31 06:39:36 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Feb 3, 2023):

Sorry, this is just something that's got to be a feature of the shell (cmd.exe, pwsh, bash, etc) itself. PowerShell has supported this for some time via PsReadline, as do most other moder shells. Alas, cmd.exe will never be able to be changed to add this feature.

Now I had an idea in mind that might help mitigate this. It'd be a little wonky, but it would persist your command history regardless of shell. And since I don't really have a thread I'm already using for tracking that, I'm tempted to hijack this thread for that purpose.

My solution wouldn't be a CLI feature - it'd be build directly into the Terminal, and the history would be exposed via a UI element in the Terminal. You okay with me re-purposing this thread?

x-link #13445

@zadjii-msft commented on GitHub (Feb 3, 2023): Sorry, this is just something that's got to be a feature of the shell (`cmd.exe`, `pwsh`, `bash`, etc) itself. PowerShell has supported this for some time via PsReadline, as do most other moder shells. Alas, [`cmd.exe` will never be able to be changed](https://github.com/microsoft/terminal/blob/main/doc/Niksa.md#why-do-we-avoid-changing-cmdexe) to add this feature. Now I had an idea in mind that might help mitigate this. It'd be a little wonky, but it would persist your command history regardless of shell. And since I don't _really_ have a thread I'm already using for tracking that, I'm tempted to hijack this thread for that purpose. My solution wouldn't be a CLI feature - it'd be build directly into the Terminal, and the history would be exposed via a UI element in the Terminal. You okay with me re-purposing this thread? x-link #13445
Author
Owner

@KyodaiKen commented on GitHub (Feb 3, 2023):

That sounds nice! I actually proposed to add it to the Terminal app itself, I wouldn't have posted it here. You can of course hijack this thread. Let's see how it goes!

@KyodaiKen commented on GitHub (Feb 3, 2023): That sounds nice! I actually proposed to add it to the Terminal app itself, I wouldn't have posted it here. You can of course hijack this thread. Let's see how it goes!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19307