bash: Find escape codes for a key
read
will print the escape sequence for any key you press.
It can be useful to find the terminal escape sequence for non-printing keys like the function or arrow keys. For example, you might want to bind a key press to an action using bind
.
- In bash, run
read
- Press the key in question.
Published on: 30 Sep 2022