When connecting to an EC2 instance (Amazon Linux) via the AWS Systems Manager (SSM) session connect feature, I'm able to successfully connect to my instance using its SSH web client. Unfortunately, I am very used to using the Alt key for navigation in the shell (e.g. Alt+f to move one word forward, Alt+b to move one word backwards). The Alt key though doesn't work via that client, is there a way to configure it?

Currently when I input Alt+b, I get the following symbols, i.e. instead of moving the cursor before the wrongarg argument, it adds the extra two characters at the end:

enter image description here

Instead of moving a word back, I get what looks like an integral symbol from Calculus!

  • What shell is that? Is it actual sh or is it bash in POSIX mode or maybe something like dash? What is the output of ps -p $$?
    – terdon
    Commented Nov 18, 2021 at 13:57
  • It is using sh which is just a symbolic link to bash: GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu) Commented Nov 18, 2021 at 14:25
  • Yep that makes sense. When bash is called as sh, it is running in "POSIX mode" and the Alt keybindings don't seem to be enabled.
    – terdon
    Commented Nov 18, 2021 at 14:53
  • Interesting, although when I ran bash directly from the sh shell, the lack of Alt keybindings persisted. Is there an easier way than what I came up with to enable support of the Alt keybindings? Commented Nov 19, 2021 at 12:33
  • 1
    You should be able to configure that in ~/.inputrc. See man 3 readline.
    – terdon
    Commented Nov 19, 2021 at 12:39

1 Answer 1


Thanks to this StackExchange post for providing the foundation for solving this.

Use the sed command to determine the key combination is sent to the terminal when the Alt-f and Alt-b sequences are entered (after each key combo you press hit the enter key to get the code e.g. \306\222):

sed -n l

Note the ƒ and the are the symbols that are displayed in my terminal when I press the Alt-f and Alt-b sequences respectively. Now armed with the key combination that is sent (excluding the ending $ character), I can use the following bash bind commands to map to the desired behavior as shown below:

bind '"\306\222":forward-word'
bind '"\342\210\253":backward-word'

And now when I enter Alt-f and Alt-b, bash moves one word forward and backwards.

  • Does anyone else have the problem there is no escape code on the SSM term? $ sed -n l f f$ b b$
    – Bae
    Commented Jun 19 at 0:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .