When I use the Ctrl+p key binding (I use the default emacs key bindings) on my command line, it sometimes works as expected, showing the previous command that I've run. I'm using the bash shell on Ubuntu 18.04.
However, sometimes it glitches: it'll hold a part of the previous line in the command line. This does not affect the next command I run, but it's still bugging me. How can I fix this?
(I'm aware that this explanation doesn't make much sense, so here's a screenshot. I cannot backspace anymore on the last command (the
touch file
line, for some reason.)
When I say "this does not affect the next command I run", here's what I mean:
Edit: my PS1 reads: \e[1;32mKR$ \e[m
echo $PS1
? – Mark Plotnick Dec 23 '19 at 18:20\[
\]
. – Kamil Maciorowski Dec 23 '19 at 18:37\[\e[1;32m\]KR$ \[\e[m\]
– Froggos Dec 23 '19 at 18:48\e[1;32m
is equivalent to key sequenceESC1;32m
... it sets text and background colors ... there is no closing bracket ... same with the\e[m
....... https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/ – jsotola Dec 23 '19 at 19:09