Sending function keys (F1-F12) over SSH
I have a Fedora machine that I can SSH to. One of the programs I'd like to use occasionally uses the function keys. The problem is that I'm SSH'ing from an Android tablet (ASUS Transformer Infinity) with a physical keyboard, but no F1-F12 keys. So, until the terminal app I'm using (VX ConnectBot) decides to add them as a feature, I'm looking for a way to send them using the rest of the keyboard.
I can use all printable ASCII characters, Esc, Ctrl, Shift, Enter, and Tab.
ssh terminal android
add a comment |
I have a Fedora machine that I can SSH to. One of the programs I'd like to use occasionally uses the function keys. The problem is that I'm SSH'ing from an Android tablet (ASUS Transformer Infinity) with a physical keyboard, but no F1-F12 keys. So, until the terminal app I'm using (VX ConnectBot) decides to add them as a feature, I'm looking for a way to send them using the rest of the keyboard.
I can use all printable ASCII characters, Esc, Ctrl, Shift, Enter, and Tab.
ssh terminal android
I think you'd be better off asking on Android.SE.
– derobert
Nov 1 '12 at 21:34
add a comment |
I have a Fedora machine that I can SSH to. One of the programs I'd like to use occasionally uses the function keys. The problem is that I'm SSH'ing from an Android tablet (ASUS Transformer Infinity) with a physical keyboard, but no F1-F12 keys. So, until the terminal app I'm using (VX ConnectBot) decides to add them as a feature, I'm looking for a way to send them using the rest of the keyboard.
I can use all printable ASCII characters, Esc, Ctrl, Shift, Enter, and Tab.
ssh terminal android
I have a Fedora machine that I can SSH to. One of the programs I'd like to use occasionally uses the function keys. The problem is that I'm SSH'ing from an Android tablet (ASUS Transformer Infinity) with a physical keyboard, but no F1-F12 keys. So, until the terminal app I'm using (VX ConnectBot) decides to add them as a feature, I'm looking for a way to send them using the rest of the keyboard.
I can use all printable ASCII characters, Esc, Ctrl, Shift, Enter, and Tab.
ssh terminal android
ssh terminal android
edited Nov 1 '12 at 22:52
Gilles
537k12810871604
537k12810871604
asked Nov 1 '12 at 20:07
SizikSizik
156115
156115
I think you'd be better off asking on Android.SE.
– derobert
Nov 1 '12 at 21:34
add a comment |
I think you'd be better off asking on Android.SE.
– derobert
Nov 1 '12 at 21:34
I think you'd be better off asking on Android.SE.
– derobert
Nov 1 '12 at 21:34
I think you'd be better off asking on Android.SE.
– derobert
Nov 1 '12 at 21:34
add a comment |
2 Answers
2
active
oldest
votes
Terminals only understand characters, not keys. So al function keys are encoded as sequences of characters, using control characters. Apart from a few common ones that have an associated control character (Tab is Ctrl+I, Enter is Ctrl+M, Esc is Ctrl+[), function keys send escape sequences, beginning with Ctrl+[ [ or Ctrl+[ O. You can use the tput command to see what escape sequence applications expect for each function key on your terminal. These sequences are stored in the terminfo database. For example, the shell snippet below shows the escape sequences corresponding to each function key.
$ for x in {1..12}; do echo -n "F$x "; tput kf$x | cat -A; echo; done
F1 ^[OP
F2 ^[OQ
F3 ^[OR
F4 ^[OS
F5 ^[[15~
F6 ^[[17~
F7 ^[[18~
F8 ^[[19~
F9 ^[[20~
F10 ^[[21~
F11 ^[[23~
F12 ^[[24~
Another way to see the escape sequence for a function key is to press Ctrl+V in a terminal application that doesn't rebind the Ctrl+V key (such as the shell). Ctrl+V inserts the next character (which will be the escape character) literally, and you'll be able to see the rest of the sequence, which consists of ordinary characters.
Since the sequences may be awkward to type, do investigate changing the key bindings in your application or using another terminal emulator. Also, note that you may have a time limit: some applications only recognize escape sequences if they come in fast enough, so that they can give a meaning to the Esc key alone.
add a comment |
Android Terminal Emulator by Jack Palevich uses key combinations with the volume keys to send a variety of keys, including function keys. There is also Hacker's Keyboard which has every key available that a real keyboard would have.
Thanks, the Hacker Keyboard should cover what I need for now.
– Sizik
Nov 2 '12 at 19:02
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f53581%2fsending-function-keys-f1-f12-over-ssh%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Terminals only understand characters, not keys. So al function keys are encoded as sequences of characters, using control characters. Apart from a few common ones that have an associated control character (Tab is Ctrl+I, Enter is Ctrl+M, Esc is Ctrl+[), function keys send escape sequences, beginning with Ctrl+[ [ or Ctrl+[ O. You can use the tput command to see what escape sequence applications expect for each function key on your terminal. These sequences are stored in the terminfo database. For example, the shell snippet below shows the escape sequences corresponding to each function key.
$ for x in {1..12}; do echo -n "F$x "; tput kf$x | cat -A; echo; done
F1 ^[OP
F2 ^[OQ
F3 ^[OR
F4 ^[OS
F5 ^[[15~
F6 ^[[17~
F7 ^[[18~
F8 ^[[19~
F9 ^[[20~
F10 ^[[21~
F11 ^[[23~
F12 ^[[24~
Another way to see the escape sequence for a function key is to press Ctrl+V in a terminal application that doesn't rebind the Ctrl+V key (such as the shell). Ctrl+V inserts the next character (which will be the escape character) literally, and you'll be able to see the rest of the sequence, which consists of ordinary characters.
Since the sequences may be awkward to type, do investigate changing the key bindings in your application or using another terminal emulator. Also, note that you may have a time limit: some applications only recognize escape sequences if they come in fast enough, so that they can give a meaning to the Esc key alone.
add a comment |
Terminals only understand characters, not keys. So al function keys are encoded as sequences of characters, using control characters. Apart from a few common ones that have an associated control character (Tab is Ctrl+I, Enter is Ctrl+M, Esc is Ctrl+[), function keys send escape sequences, beginning with Ctrl+[ [ or Ctrl+[ O. You can use the tput command to see what escape sequence applications expect for each function key on your terminal. These sequences are stored in the terminfo database. For example, the shell snippet below shows the escape sequences corresponding to each function key.
$ for x in {1..12}; do echo -n "F$x "; tput kf$x | cat -A; echo; done
F1 ^[OP
F2 ^[OQ
F3 ^[OR
F4 ^[OS
F5 ^[[15~
F6 ^[[17~
F7 ^[[18~
F8 ^[[19~
F9 ^[[20~
F10 ^[[21~
F11 ^[[23~
F12 ^[[24~
Another way to see the escape sequence for a function key is to press Ctrl+V in a terminal application that doesn't rebind the Ctrl+V key (such as the shell). Ctrl+V inserts the next character (which will be the escape character) literally, and you'll be able to see the rest of the sequence, which consists of ordinary characters.
Since the sequences may be awkward to type, do investigate changing the key bindings in your application or using another terminal emulator. Also, note that you may have a time limit: some applications only recognize escape sequences if they come in fast enough, so that they can give a meaning to the Esc key alone.
add a comment |
Terminals only understand characters, not keys. So al function keys are encoded as sequences of characters, using control characters. Apart from a few common ones that have an associated control character (Tab is Ctrl+I, Enter is Ctrl+M, Esc is Ctrl+[), function keys send escape sequences, beginning with Ctrl+[ [ or Ctrl+[ O. You can use the tput command to see what escape sequence applications expect for each function key on your terminal. These sequences are stored in the terminfo database. For example, the shell snippet below shows the escape sequences corresponding to each function key.
$ for x in {1..12}; do echo -n "F$x "; tput kf$x | cat -A; echo; done
F1 ^[OP
F2 ^[OQ
F3 ^[OR
F4 ^[OS
F5 ^[[15~
F6 ^[[17~
F7 ^[[18~
F8 ^[[19~
F9 ^[[20~
F10 ^[[21~
F11 ^[[23~
F12 ^[[24~
Another way to see the escape sequence for a function key is to press Ctrl+V in a terminal application that doesn't rebind the Ctrl+V key (such as the shell). Ctrl+V inserts the next character (which will be the escape character) literally, and you'll be able to see the rest of the sequence, which consists of ordinary characters.
Since the sequences may be awkward to type, do investigate changing the key bindings in your application or using another terminal emulator. Also, note that you may have a time limit: some applications only recognize escape sequences if they come in fast enough, so that they can give a meaning to the Esc key alone.
Terminals only understand characters, not keys. So al function keys are encoded as sequences of characters, using control characters. Apart from a few common ones that have an associated control character (Tab is Ctrl+I, Enter is Ctrl+M, Esc is Ctrl+[), function keys send escape sequences, beginning with Ctrl+[ [ or Ctrl+[ O. You can use the tput command to see what escape sequence applications expect for each function key on your terminal. These sequences are stored in the terminfo database. For example, the shell snippet below shows the escape sequences corresponding to each function key.
$ for x in {1..12}; do echo -n "F$x "; tput kf$x | cat -A; echo; done
F1 ^[OP
F2 ^[OQ
F3 ^[OR
F4 ^[OS
F5 ^[[15~
F6 ^[[17~
F7 ^[[18~
F8 ^[[19~
F9 ^[[20~
F10 ^[[21~
F11 ^[[23~
F12 ^[[24~
Another way to see the escape sequence for a function key is to press Ctrl+V in a terminal application that doesn't rebind the Ctrl+V key (such as the shell). Ctrl+V inserts the next character (which will be the escape character) literally, and you'll be able to see the rest of the sequence, which consists of ordinary characters.
Since the sequences may be awkward to type, do investigate changing the key bindings in your application or using another terminal emulator. Also, note that you may have a time limit: some applications only recognize escape sequences if they come in fast enough, so that they can give a meaning to the Esc key alone.
edited 21 mins ago
terdon♦
131k32256434
131k32256434
answered Nov 1 '12 at 22:52
GillesGilles
537k12810871604
537k12810871604
add a comment |
add a comment |
Android Terminal Emulator by Jack Palevich uses key combinations with the volume keys to send a variety of keys, including function keys. There is also Hacker's Keyboard which has every key available that a real keyboard would have.
Thanks, the Hacker Keyboard should cover what I need for now.
– Sizik
Nov 2 '12 at 19:02
add a comment |
Android Terminal Emulator by Jack Palevich uses key combinations with the volume keys to send a variety of keys, including function keys. There is also Hacker's Keyboard which has every key available that a real keyboard would have.
Thanks, the Hacker Keyboard should cover what I need for now.
– Sizik
Nov 2 '12 at 19:02
add a comment |
Android Terminal Emulator by Jack Palevich uses key combinations with the volume keys to send a variety of keys, including function keys. There is also Hacker's Keyboard which has every key available that a real keyboard would have.
Android Terminal Emulator by Jack Palevich uses key combinations with the volume keys to send a variety of keys, including function keys. There is also Hacker's Keyboard which has every key available that a real keyboard would have.
answered Nov 1 '12 at 20:55
Drake ClarrisDrake Clarris
72037
72037
Thanks, the Hacker Keyboard should cover what I need for now.
– Sizik
Nov 2 '12 at 19:02
add a comment |
Thanks, the Hacker Keyboard should cover what I need for now.
– Sizik
Nov 2 '12 at 19:02
Thanks, the Hacker Keyboard should cover what I need for now.
– Sizik
Nov 2 '12 at 19:02
Thanks, the Hacker Keyboard should cover what I need for now.
– Sizik
Nov 2 '12 at 19:02
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f53581%2fsending-function-keys-f1-f12-over-ssh%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think you'd be better off asking on Android.SE.
– derobert
Nov 1 '12 at 21:34