Skip to content

Arrow keys don't work in Ubuntu Bash on Windows #10163

Closed

Description

@u84six
  • VSCode Version: 1.3.1
  • OS Version: Windows 10

Steps to Reproduce:

  1. Bind bash.exe path to integrated shell ("terminal.integrated.shell.windows": "C:\Windows\sysnative\bash.exe")
  2. Open terminal by Ctrl-Shift-~
  3. Type a command: echo hello world
  4. Use up arrow to find the command in history (doesn't work)

This works in the new stand-alone bash terminal. This also works on a mac. Just not vsc.

Activity

  1. phfsantos commented on Aug 5, 2016

    @phfsantos

    I am also having the same issue. It does not work on version 1.4 neither.
    Arrows left and right also not working.

  2. added
    bug
    upstream
    terminal
    on Aug 5, 2016
  3. added this to the Backlog milestone on Aug 5, 2016
  4. added
    windows
    on Aug 5, 2016
  5. vrabcak commented on Aug 6, 2016

    @vrabcak

    It is related to microsoft/WSL#111

  6. Tyriar commented on Aug 8, 2016

    @Tyriar
    Contributor

    Tomas Tichy (@vrabcak) thanks a bunch for pointing this issue out!

  7. changed the title [-]Bash terminal history up/down arrows not working[/-] [+]Arrow keys don't work in Ubuntu Bash on Windows[/+] on Aug 17, 2016
  8. cybrown commented on Sep 23, 2016

    @cybrown

    For those using bash for windows in vscode and cannot wait to use the history, here are some usefull commands involving the bang character when arrow keys are not available: http://ss64.com/bash/bang.html

  9. u84six commented on Oct 9, 2016

    @u84six
    Author

    I can't believe that this one is still not working. I submitted this back and August. How long does it take to support a simple history buffer? The native shell (Win10 bash) works, why not vsc?

  10. Tyriar commented on Oct 9, 2016

    @Tyriar
    Contributor

    u84six as mentioned above, this is an upstream issue microsoft/WSL#111

  11. longtomjr commented on Oct 14, 2016

    @longtomjr

    just want to chime in ;). The Developer of ConEmu, Maksim Moisiuk (@Maximus5), has come up with a workaround for this issue. It might be worth it to look at what he did. :)

  12. 12 remaining items

  13. wclr commented on Dec 15, 2016

    @wclr

    The same problem here when working with docker container's bash session: docker-compose exec container-name bash

  14. CherryDT commented on Dec 28, 2016

    @CherryDT

    There is a simple workaround for using the history: Use the bash commands which use the Ctrl key! Yes, bash has those, but most people forgot their existence, it seems.

    Ctrl+P: Previous command (like up arrow)
    Ctrl+N: Next command (like down arrow)
    Ctrl+B: One character backwards (like left arrow)
    Ctrl+F: One character forwards (like right arrow)
    Ctrl+A: Start of line (like home key)
    Ctrl+E: End of line (like end key)
    Ctrl+D: Delete character (like delete key)

    For details, see http://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html#Bindable-Readline-Commands

    There is just one small issue: Ctrl+P (arguably one of the most important commands) is usually executed by VSCode to show "Quick Open". There are three ways to solve this: You could reassign the "previous-history" command in bash, reassign the "workbench.action.quickOpen" command in VSCode, or - arguably the easiest solution - change your "terminal.integrated.commandsToSkipShell" setting in VSCode to exclude "workbench.action.quickOpen" (you would then have to move focus away from the terminal to have VSCode respond to Ctrl+P).

  15. horihiro commented on Dec 30, 2016

    @horihiro

    I tried wslbridge to use arrow keys on terminal, and I successed.

    1. Download and execute wslbridge installer
    2. Add following code to User Settings of Visual Studio Code.
    {
      "terminal.integrated.shell.windows": "C:\\Users\\%USERNAME%\\AppData\\Local\\wsltty\\bin\\wslbridge.exe"
    }
    

    NOTICE: you can NOT use an environment variable (i.e. %USERNAME%) in User Settings, you have to replace to your username.

  16. Tyriar commented on Jan 3, 2017

    @Tyriar
    Contributor

    Hirofumi Horikawa (@horihiro) good to know you got this working that way as a temporary work around 👍

  17. u84six commented on Jan 20, 2017

    @u84six
    Author

    Does closing this mean that it's fixed? What do I have to update to fix this problem because it's still not working.

  18. Tyriar commented on Jan 20, 2017

    @Tyriar
    Contributor

    u84six it's fixed in the Insiders build which you can test here, it should included in v1.9.0 in ~2 weeks time.

  19. khards commented on Feb 27, 2017

    @khards

    Good to hear that it's fixed in the insiders build. Perhaps I can encourage some Apple fanboys to develop on windows not we have all the Unix CLI tools built in.

  20. gengxuelei commented on Mar 22, 2017

    @gengxuelei

    when type 'blank' or 'tab' ,there is a wrong blank space,use 'cat sth.txt',repeat this bug

  21. locked and limited conversation to collaborators on Nov 18, 2017
  22. added a commit that references this issue on Sep 6, 2026
    76c0b8b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugterminalupstreamverifiedwindows

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions