Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is terminal escape sequence for ctrl + arrow (left, right,...) in TERM=linux

I am building a terminal window in a browser (sth. like ajaxterm) and don't know which escape sequence to send to ssh tunnel (opened via paramiko.SSHClient().invoke_shell(term='linux')).

I have found a key logger and tried it in a terminal with $TERM == 'linux', but it returns the same sequence for ctrl+left and left (27,91,68).

If I try keylogger in another terminal (with $TERM == 'xterm') I get the codes (27,91,49,59,53,68). But these codes do not move generate the expected output from SSH channel (which would move cursor one word left on a normal linux shell). That is true even if I start paramiko with term='xterm'.

Any idea what sequence I should use? Or why the above sequence doesn't work?

UPDATE: I would be happy to use another terminal type (not "linux"), but unfortunately pyte works with VTxxx terminals only (I believe "linux" is vt220-like terminal - anyway, it works), so xterm doesn't work properly.

like image 710
johndodo Avatar asked Oct 14 '11 12:10

johndodo


People also ask

What is escape sequence in Linux?

All the format strings shown so far have ended in \n . This kind of construct is called an escape sequence. All escape sequences are made from a backslash character ( \ ) followed by one to three other characters. Escape sequences are used inside strings, not just those for printf, to represent special characters.

What is an escape sequence in terminal?

ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text.

What is ESC 0m?

ESC[0m. reset all modes (styles and colors)


1 Answers

A quick check with od -c reveals that gnome-termainal generates these values:

Left-arrow generates ESC-[-D.

Control-left-array geneates ESC-[-1-;-5-D

like image 174
Robᵩ Avatar answered Oct 25 '22 17:10

Robᵩ