Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
18
votes
2
answers
19193
views
bash: Shift+arrow keys make A,B,C,D
When using the bash shell, I tried to use Shift + LEFT to highlight and copy the command I typed in (rather then using the mouse). However, I got a lot of C's instead. I later realized that Shift + UP makes `A`, Shift + DOWN makes `B`, and Shift + RIGHT also makes `D`. Why does this happen? I think...
When using the bash shell, I tried to use Shift+LEFT to highlight and copy the command I typed in (rather then using the mouse). However, I got a lot of C's instead. I later realized that Shift+UP makes
A
, Shift+DOWN makes B
, and Shift+RIGHT also makes D
.
Why does this happen?
I think it is from the raw keystroke data (^[[A
,^[[B
,^[[C
, and ^[[D
), but it is just a capital letter (no ^[[
at the beginning).
Zackary
(353 rep)
May 16, 2018, 05:48 PM
• Last activity: May 9, 2024, 08:01 PM
0
votes
2
answers
624
views
Ctrl + arrow recognize as only arrow on shell
On a newly installed *archlinux*, my shells (`bash`, `zsh`, `tcsh`) don’t distinguish arrow key and Ctrl + arrow keys , or Shift + arrow keys . `cat` command shows the same code for left arrow, Ctrl + Left arrow or Shift + Left arrow : `^[[D` This is annoying because it prevents me to configure the...
On a newly installed *archlinux*, my shells (
bash
, zsh
, tcsh
) don’t distinguish arrow key and Ctrl+arrow keys, or Shift+arrow keys.
cat
command shows the same code for left arrow, Ctrl+Left arrow or Shift+Left arrow: ^[[D
This is annoying because it prevents me to configure the word-by-word displacement, and the selection of text in shells, but it is not a crucial matter since I still can navigate character by character.
In nano however Ctrl and Shift+arrow work well, with word-by-word displacement and text selection without any trouble.
I precise that it is my first arch-linux install, and I may have forgot basic configuration responsible for this problem.
How make Ctrl/Shift+Arrow detected in my shells?
-- edit to add required information --
zle-line-init() echoti smkx
don't solve the problem,
echoti smkx; STTY='-icanon -echo min 0 time 20' od -vtc -tx1
output the following :
no such terminfo capability: smkx
00000000 033 [ D
1b 5b 44
00000003
for both left and ctrl+left,
and for echoti rmkx; STTY='-icanon -echo min 0 time 20' od -vtc -tx1
:
no such terminfo capability: rmkx
00000000 033 [ D
1b 5b 44
00000003
for both left and ctrl+left
I use the default Terminal of Arch-linux, which if my understanding is correct, is call linux ($TERM
output
and I have no /etc/inittabl
that could mask the true terminal)
Halphasten
(1 rep)
Dec 16, 2022, 07:53 AM
• Last activity: Dec 20, 2022, 12:51 PM
0
votes
0
answers
116
views
re-bind keys highlight text in terminal
I want re-bind keys on CentOS 8 to be able use combination Ctrl + Shift + arrow key to highlighted a text in terminal. I found keybinding file in: /etc/inputrc Ctrl + Shift + arrow key is: ^[[1;6C ^[[1;6D But I don't know what write in that file. Normally when I use this combination I get in termina...
I want re-bind keys on CentOS 8 to be able use combination Ctrl + Shift + arrow key to highlighted a text in terminal.
I found keybinding file in:
/etc/inputrc
Ctrl + Shift + arrow key is:
^[[1;6C
^[[1;6D
But I don't know what write in that file.
Normally when I use this combination I get in terminal "D" or "C". Could you give me a hint about that or this is even possible?
Plazma
(1 rep)
Mar 26, 2020, 08:02 PM
1
votes
0
answers
182
views
Avoid ANSI codes in bash prompt when using arrow keys
First of all, aw two things to make clear: - Yes I've seen there are already several questions with a similar sounding headline, but they are neither talking about the same situation nor do they have a satisfactory answer. - When I mean "bash prompt" I'm not talking about the prompt my terminal/shel...
First of all, aw two things to make clear:
- Yes I've seen there are already several questions with a similar sounding headline, but they are neither talking about the same situation nor do they have a satisfactory answer.
- When I mean "bash prompt" I'm not talking about the prompt my terminal/shell gives me, but a
read
prompt inside an interactive script. I don't experience this issue only inside a script, not in the "normal" shell prompt (in my case: macOS Terminal Application, Bash 5.0).
That being said, I have user prompt inside my script. Let's say, it looks like the following:
read -rp "Enter your name: " name
So far, so good. As long as the user doesn't make a spelling mistake this probably works without any issues. Yet, when the user wants to correct something they better not use the arrow keys. If they do, contrary to their expectations, the curser won't move, but weird characters appear:
Enter your name: Sanantha^[[D
Is there a way to avoid these - what I've learned from the other threads - ANSI codes from appearing? The expected behavior would be to actually move the curser to the left by one character, each time the "left" key is pressed.
As this is a script to be distributed, it would be best, if this can be fixed inside the script and doesn't require messing with config files.
Kind regards!
Max
(11 rep)
Feb 29, 2020, 09:04 PM
0
votes
1
answers
462
views
Why does delete work but not arrow keys in terminal?
In a linux terminal I use "cat > file.txt" to make a file one line at a time. What I find is that per-line the delete key works but the arrow keys insert escape codes rather than moving left and right in the line. Why is this? Is there a reason that the terminals basic action cannot do left and righ...
In a linux terminal I use "cat > file.txt" to make a file one line at a time.
What I find is that per-line the delete key works but the arrow keys insert escape codes rather than moving left and right in the line.
Why is this? Is there a reason that the terminals basic action cannot do left and right arrow keys? I know there are things like GNU readline which do it but my question is not about those.
river
(103 rep)
Jun 12, 2019, 04:56 PM
• Last activity: Jun 12, 2019, 05:33 PM
3
votes
3
answers
4092
views
Windows bash takes arrows as symbols via ssh and fish shell on server
I have a bit complicated question. I am using Windows 10 Anniversary Update with Bash for Ubuntu. I am connecting to server via `ssh`. This server uses `fish shell`. And when I press arrows it just prints some symbols instead of showing me command history or guessing my next command. Here is what I...
I have a bit complicated question. I am using Windows 10 Anniversary Update with Bash for Ubuntu. I am connecting to server via
ssh
. This server uses fish shell
. And when I press arrows it just prints some symbols instead of showing me command history or guessing my next command. Here is what I see:
- arrow up prints [A
- arrow down prints [B
- arrow right prints [C
- arrow left prints [D
However, arrows works fine in bash
. Is there any ideas why it is happening?
Vittore Gravano
(131 rep)
Oct 18, 2016, 02:46 PM
• Last activity: Jan 9, 2019, 05:51 AM
3
votes
1
answers
2192
views
Arrow keys in OpenBSD's ksh, command line editing, Vi-mode
I'm using the default [`ksh` on OpenBSD 6.2](http://man.openbsd.org/ksh) (based on `pdksh`) with Vi command line editing mode enabled. I'm trying to get the arrow keys to work properly as a complement to h , l , j and k (as I'm on a Dvorak keyboard). As far as I can tell, they don't work at all. It...
I'm using the default [
ksh
on OpenBSD 6.2](http://man.openbsd.org/ksh) (based on pdksh
) with Vi command line editing mode enabled.
I'm trying to get the arrow keys to work properly as a complement to h, l, j and k (as I'm on a Dvorak keyboard). As far as I can tell, they don't work at all. It does not matter whether I'm in "input" or "command" mode.
The current key bindings includes:
^[[A = up-history
^[[B = down-history
^[[C = forward-char
^[[D = backward-char
These are also the character sequenced produced by my arrow keys if I use Ctrl+VArrow key.
The arrow keys works as expected in Emacs command line editing mode, but as a long time Vi user, I feel somewhat crippled when using it.
My feeling is that the Escape that is sent by the arrow key is interpreted as if I pressed Esc... I get the equivalent behaviour by manually typing e.g. Esc[A as when I press Up-arrow (places me in command mode and then in insert mode at the end of the line).
Question: Has anyone been able to get the arrow keys to work intuitively in Vi-mode in OpenBSD's ksh
?
Kusalananda
(354468 rep)
Jan 29, 2018, 12:02 PM
• Last activity: Feb 28, 2018, 02:33 PM
0
votes
1
answers
591
views
3 arrow keys don't work and spontaneous full kbd failure
I'm running Linux Mint 18.1 MATE Edition on my Acer Aspire R14 R5-471T-51UN. **Problem 1** is semi fixed: When the laptop went into suspend mode while on battery when I awakened it to log back in the keyboard quit working (except for the function buttons/features). I was unable to type anything. Usi...
I'm running Linux Mint 18.1 MATE Edition on my Acer Aspire R14 R5-471T-51UN.
**Problem 1** is semi fixed: When the laptop went into suspend mode while on battery when I awakened it to log back in the keyboard quit working (except for the function buttons/features). I was unable to type anything. Using the on-screen keyboard in the login screen I was able to log in but still unable to type anything or use Alt-Tab, etc.
The suggestion I found was to edit grub via this answer:
> https://askubuntu.com/a/940323/177637
>
> Basically, run this in a shell to confirm you are applicable to this
> solution:
>
> dmesg | grep i8042 and confirm you get this output
>
> [ 1.514469] i8042: PNP: PS/2 Controller [PNP0303:KBC,PNP0f13:MOUE] at
> >0x60,0x64 irq 1,12 [ 1.525273] serio: i8042 KBD port at 0x60,0x64 irq 1 ?[ 1.525287] serio: i8042 AUX port at 0x60,0x64 irq 12 [ 1.526035]
> input: AT Raw Set 2 keyboard as
> >/devices/platform/i8042/serio0/input/input3 [ 21.927438] input: SynPS/2 Synaptics TouchPad as
> >/devices/platform/i8042/serio1/input/input10 then, add the boot parameters i8042.direct and i8042.dumbkbd to >/etc/default/grub.
>
> For example, run
>
> sudo nano /etc/default/grub Find the line that begins
> GRUB_CMDLINE_LINUX_DEFAULT= and edit it to >include the new
> parameters, so that after your edit it looks something >like
>
> GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.direct i8042.dumbkbd"
> Save by pressing Ctrl+O, exit by pressing Ctrl+X, and run
>
> sudo update-grub
**Problem 2**: My right, up, and down arrow keys don't work now, which has disabled my ability to brighten or dim the screen and raise or lower the volume using the Function key, and many more obvious problems. My left arrow key works.
The Pg Up (Home) and Pg Dn (End) buttons (functions) do work, they are right next to arrow keys.
I don't know what to do to fix this. It's so odd!!
In my Keyboard settings I have English (US) selected and Acer Laptop selected as the model. I've tried other options and it doesn't change anything.
"Reset to Default" for Options has been hit numerous times in the hopes that it would fix it. I never did modify anything as far as keyboard, layout, shortcuts, or locale goes.
**Problem 3**: Occasionally the entire keyboard quits working without a known reason why. The only way I've found to restore it is to restart the computer.
Any help is appreciated.
dmesg: https://pastebin.com/9kQu85WV
setxkbmap -print: https://pastebin.com/t3sSd7er
BrittanyD
(11 rep)
Aug 13, 2017, 08:09 PM
• Last activity: Sep 1, 2017, 07:18 PM
1
votes
0
answers
518
views
Unable to use up arrow key in screen copy mode or windowlist
I am ssh'ing from a terminal window on my Mac to a NetBSD box (our bastion host) and then running screen on the NetBSD box. In copy mode or in the windowlist (which uses the copymode key bindings), I can use the 'hjkl' keys for cursor movement, and I can use 3 of the 4 arrows, but not up arrow. I be...
I am ssh'ing from a terminal window on my Mac to a NetBSD box (our bastion host) and then running screen on the NetBSD box.
In copy mode or in the windowlist (which uses the copymode key bindings), I can use the 'hjkl' keys for cursor movement, and I can use 3 of the 4 arrows, but not up arrow. I believe I have found the cause with
^A:bindkey -m
which says:
>:kF: -> stuff ^D
:kR: -> stuff ^U
:kh: -> stuff \201
:kH: -> stuff \205
:kN: -> stuff ^F
:kP: -> stuff ^B
**:ku: -> stuff ^@**
:kd: -> stuff \216
:kr: -> stuff \206
:kl: -> stuff \202
However, I don't seem to be able to override the :ku:
binding.
Trying to change it:
bindkey -m :ku: stuff \220
just adds a new useless binding at the end of the list, but trying to delete the original one with:
bindkey -m :ku:
does nothing.
**Is there some way I can fix this?**
> Notes:
>>Mac:
>>>OS X 10.11.6 (El Capitan)
>>>$TERM = xterm-256color
>>NetBSD:
>>>6.1.2
>>>$TERM = xterm-256color
>>>There appears to be no system screenrc
>>>My .screenrc says only: defscrollback 8192
John Hascall
(287 rep)
Jan 30, 2017, 09:51 PM
3
votes
2
answers
2507
views
How to Have key-repeats of Arrow keys when disabled key-repeats?
I need disabled key-repeats because 10% greater long-term WPM then, as described in the thread [How to Calibrate typing when unstable Cursor/Typing in Debian][1]. However, I think the feature of repositioning caret position is useful with long-presses of arrow-keys in using key-repeats. I would like...
I need disabled key-repeats because 10% greater long-term WPM then, as described in the thread How to Calibrate typing when unstable Cursor/Typing in Debian .
However, I think the feature of repositioning caret position is useful with long-presses of arrow-keys in using key-repeats.
I would like to maintain the long-presses of them but have custom settings for *delay* and *speed*.
My settings in *Keyboard > Typing* where the *delay* and *option* should be individualized for arrow-keys in Fig. 1.
Options where I cannot get (1) work at all and I keep option (2) too cumbersome for the task because of many buttons and keyboards
1. Disable all key-repeats and enable then those of arrow keys.
2. Allow all key-repeats and disable everything else than arrow keys. (olejorgenb's answer ) - - I think this proposal is not solid so reject because cannot reproduce the effect as described. - - Also outside of the scope of the question in the title.
Fig. 1 Unchecked *Key presses repeat when key is held down*
Differential solutions
1. Is there a way to have it so that key repeats aren't disabled but only start after you've held a key down for a longer time? [Random832] - - Actually, I would like to know how this can work if you make many rapid changes in the directions of arrow-keys.
Hardware: Asus Zenbook UX303UA
OS: Debian 8.5 64 bit
Linux kernel: 4.6

Léo Léopold Hertz 준영
(7138 rep)
Sep 3, 2016, 09:13 AM
• Last activity: Sep 24, 2016, 08:40 AM
Showing page 1 of 10 total questions