按下键盘上下左右键显示为^[[A ^[[B ^[[D ^[[C

563 阅读1分钟

来源:unix.stackexchange.com/questions/1…

You're probably running sh which outputs the raw keycodes generated when you press the Up arrow key.

A more advanced shell like bash intercepts these keycodes and does something with them. E.g. show the last command in its history.

To fix your issue, type bash to enter a bash shell. Then use the up/down arrow commands (note, your history would start afresh in the new shell).

总结,换一个命令行shell,如bash。

我使用Ubuntu部署的VS Code Server,默认的命令行工具是sh,不能正常响应键盘的上下左右键。切换到bash后,按下键盘的上下左右键就可以正常响应了。