[Feature Request] Cycle only unique commands #490

Closed
opened 2026-01-30 21:53:35 +00:00 by claunia · 7 comments
Owner

Originally created by @Splike on GitHub (Dec 14, 2018).

After reading this blog post on New Experimental Console Features, I thought this was the right time to ask for a feature request, that could be added to the terminal options. (Or maybe even made as default behaviour?)

When cycling previously run commands with the up-arrow, it will take 8 key-presses to reach the ls command in the example below
(read from bottom to top)

$ ls
$ java main.
$ javac main.java
$ java main
$ javac main.java
$ java main
$ javac main.java
$ java main

But I want an option to remove duplicate commands, when cycling through them, so in the example, it would only take 3 key-presses
(read from bottom to top)

$ ls
$ javac main.java
$ java main
Originally created by @Splike on GitHub (Dec 14, 2018). After reading this blog post on [New Experimental Console Features](https://blogs.msdn.microsoft.com/commandline/2018/12/10/new-experimental-console-features/), I thought this was the right time to ask for a feature request, that could be added to the terminal options. (Or maybe even made as default behaviour?) When cycling previously run commands with the up-arrow, it will take 8 key-presses to reach the `ls` command in the example below (read from bottom to top) ``` $ ls $ java main. $ javac main.java $ java main $ javac main.java $ java main $ javac main.java $ java main ``` But I want an option to remove duplicate commands, when cycling through them, so in the example, it would only take 3 key-presses (read from bottom to top) ``` $ ls $ javac main.java $ java main ```
claunia added the Product-WSLResolution-ExternalResolution-Won't-Fix labels 2026-01-30 21:53:35 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Dec 14, 2018):

Ah, that'd be a cmd.exe feature request, not a conhost feature request. cmd is the shell application, while conhost is the console or terminal application, responsible for drawing commandline apps.

What the "Experimental" new features applies to is the console, not the shell. We unfortunately can't add any new features to cmd.exe, full stop. It doesn't matter how good of a feature idea it is, we unfortunately just can't do it :/

The official party line is if you'd like new shell features, I'd recommend powershell, as they're opensource and accepting community contributions with regards to shell features.

@zadjii-msft commented on GitHub (Dec 14, 2018): Ah, that'd be a `cmd.exe` feature request, not a `conhost` feature request. `cmd` is the shell application, while `conhost` is the console or terminal application, responsible for drawing commandline apps. What the "Experimental" new features applies to is the console, not the shell. We unfortunately can't add any new features to cmd.exe, full stop. It doesn't matter how good of a feature idea it is, we unfortunately just can't do it :/ The official party line is if you'd like new shell features, I'd recommend powershell, as they're opensource and accepting community contributions with regards to shell features.
Author
Owner

@oising commented on GitHub (Dec 14, 2018):

Really? This feature has been there for as long as I can remember...

image

@oising commented on GitHub (Dec 14, 2018): Really? This feature has been there for as long as I can remember... ![image](https://user-images.githubusercontent.com/1844001/50030702-8848a280-ffc2-11e8-860a-cb019afa8def.png)
Author
Owner

@Splike commented on GitHub (Dec 14, 2018):

Really? This feature has been there for as long as I can remember...

Thanks for letting me know about this. But ticking the option box for a WSL window does nothing, compared to a powershell window, where it works.

@Splike commented on GitHub (Dec 14, 2018): > Really? This feature has been there for as long as I can remember... Thanks for letting me know about this. But ticking the option box for a WSL window does nothing, compared to a powershell window, where it works.
Author
Owner

@Splike commented on GitHub (Dec 14, 2018):

@zadjii-msft

The option showed by @oising above, does what I want. The problem is that it works for Powershell and cmd. But in my WSL Ubuntu window, the option has no effect. Even after restarting the application.

@Splike commented on GitHub (Dec 14, 2018): @zadjii-msft The option showed by @oising above, does what I want. The problem is that it works for Powershell and cmd. But in my WSL Ubuntu window, the option has no effect. Even after restarting the application.
Author
Owner

@zadjii-msft commented on GitHub (Dec 14, 2018):

I literally forgot that that checkbox existed until just now.

I guess that affects the history parts of the console API, which both cmd and powershell use. WSL shells however don't use the console API's at all. This sounds like a feature request for bash or whatever linux shell you're using, nothing we can really do to control those applications.

@zadjii-msft commented on GitHub (Dec 14, 2018): I literally forgot that that checkbox existed until just now. I guess that affects the history parts of the console API, which both cmd and powershell use. WSL shells however don't use the console API's at all. This sounds like a feature request for `bash` or whatever linux shell you're using, nothing we can really do to control those applications.
Author
Owner

@oising commented on GitHub (Dec 15, 2018):

History management in Ubuntu is part of your chosen shell. Maybe this can help: https://stackoverflow.com/questions/338285/prevent-duplicates-from-being-saved-in-bash-history

@oising commented on GitHub (Dec 15, 2018): History management in Ubuntu is part of your chosen shell. Maybe this can help: https://stackoverflow.com/questions/338285/prevent-duplicates-from-being-saved-in-bash-history
Author
Owner

@Splike commented on GitHub (Dec 15, 2018):

@oising and @zadjii-msft

Thanks to both of you for helping me out.
I figured out that I had to change the HISTCONTROL value in the ~/.bashrc file to the following

HISTCONTROL=ignoreboth:erasedups
@Splike commented on GitHub (Dec 15, 2018): @oising and @zadjii-msft Thanks to both of you for helping me out. I figured out that I had to change the `HISTCONTROL` value in the `~/.bashrc` file to the following ``` HISTCONTROL=ignoreboth:erasedups ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#490