Essentially I just want to press Ctrl+Tab, not Ctrl+A then Tab. I don't believe this can be accomplished with an alias, but have read some stuff about maybe using stty? But I've never used stty and not sure how this would be done.

  • Use xbindkeys+xdotool. – Ipor Sircer Oct 26 '18 at 17:43
  • What screens are you referring to here? You have tagged this with gnu-screen. Do you mean switching between GNU screen windows in a terminal? – Kusalananda Oct 26 '18 at 17:45
  • Are you running GNU screen in an X11 environment like Gnome or KDE or similar desktop manager? – Kusalananda Oct 26 '18 at 18:19
  • How are you access the Unix machine? Is it from X-windows, or SSH'd in from from an MS-Windows machine (eg with putty) or some other method? – Stephen Harris Oct 26 '18 at 18:19
  • I have Bash on Ubuntu on Windows, running xterm-256Color. I usually just open two windows to have 2 different environments to work in, but have found "screen" command which has kind of what i'm looking for stackoverflow.com/questions/614785/… Although something that I dont like about this is that you cant scroll up the different sessions, it only allows you to scroll up both at the same time. What do you guys use to partition your terminals in half? – Adam Farnsworth Oct 30 '18 at 16:51

Yes, but only with the cooperation of your terminal emulator. Terminal emulators send escape sequences (or in a few cases a single control character) to indicate the press of a function key. See the “terminal — input” section of How do keyboard input and text output work? for more details. You need to configure your terminal to send a unique escape sequence for Ctrl+Tab. Some terminals send the Tab character for both plain Tab and Ctrl+Tab, so that applications can't distinguish between them. To see what your terminal sends, press Ctrl+V then Ctrl+Tab. If you see a few spaces, that's bad and you need to reconfigure your terminal, if possible. How to do that depends entirely on the terminal software. If you see something like ^[O5 (escape, O, 5), that's fine.

Assuming that your terminal sends a unique escape sequence for Ctrl+Tab, you can tell Screen what to do with it with the command bindkey. (It's bind for bindings that start with the “Screen key” Ctrl+A, and bindkey for other key bindings). For example, with the control sequence above, put the following line in your .screenrc:

bindkey ^[O5 next
  • It does give me a space when pressing Ctrl + V then Ctrl + Tab. But i'm finding out that "screen" is a command i'm not liking, and am searching for something else to help me partition one terminal in half into two. – Adam Farnsworth Oct 30 '18 at 16:53

If you are using xterm, add this to your ~/.Xresources file:

*vt100.translations: #override \n\
        Ctrl ~Shift <Key>Tab: string(0x1b) string("[27;5;9~") \n \
        Ctrl Shift <Key>Tab: string(0x1b) string("[27;6;9~") \n

This goes in your screenrc configuration file:

bindkey "^[[27;5;9~" focus

Make sure to log out of your X session.

  • 4
    xrdb -merge ~/.Xresources can be used to merge in the changes to the existing session so the next xterm will pick up the changes. – Stephen Harris Oct 26 '18 at 18:18

Use xbindkeys+xdotool. Append to ~/.xbindkeysrc:

"xdotool key ctrl+a Tab"
    release+Control + Tab
  • 1
    This is assuming that the user runs some sort of desktop environment (or at least X11), right? This is very likely, but not universal (I don't, for example). – Kusalananda Oct 26 '18 at 18:15
  • This would make it impossible to use Ctrl+Tab normally in other applications. – Gilles 'SO- stop being evil' Oct 26 '18 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.