2

OK. So I love screen. It has saved my bacon a few times when machines crash or get disconnected from the network. However, there are enough reasons keep keep me from using screen for everything, which include:

  1. Pain in the butt scrolling. Why can't I just interact as though this is a normal bash shell?
  2. My keyboard shortcuts are gone. I have a number of things customized in my bash environment, is there a way to get them to work in screen as well?

Are there any tools our tips that I can use to make my screen-using experience as high quality as my bash using experience?

4
  • This isn't a programming question, and I voted to close as off topic, but what do you mean your bash shortcuts are gone? Unless you're using your screen meta key in the shortcurts, your shell should work exactly how it does without screen.
    – Wooble
    Jun 28, 2012 at 17:35
  • 1
    For example, ctrl-(left arrow) prints "D" instead of scrolling to the word to the left.
    – lonestar21
    Jun 28, 2012 at 17:37
  • 1
    Where is a better venue for the question?
    – lonestar21
    Jun 28, 2012 at 17:38
  • @lonestar21 - unix.stackexchange.com. You should be able to request a move. tmux may be what you are looking for.
    – jordanm
    Jun 28, 2012 at 18:35

3 Answers 3

3

This is a long and basic answer, but I've also covered the Ctrl-D issue you listed in the OP's reply below

I see great confusion here of terminal and shell. Scrolling is not done by your shell, but by your terminal. What screen and tmux do, is to add another terminal on top of your your gnome-terminal for each subwindow (that may sound weird at first but a terminal is not exactly what you see but really just a device, often under /dev/pts/, where a process can read bytes from and write bytes to).

As screen runs its pseudo-terminal(s) on top of your gnome-terminal, it has no chance to intercepting the keys that gnome-terminal already intercepts. It needs to have its own shortcut keys, and you as the user are not supposed to press the shortcut keys that gnome-terminal understands. You can, but the result will not be what you expected as gnome-terminal does not know of the mess that screen created.

You might indeed have shortcuts only intercepted by your shell (not by the terminal where the shell reads its characters from), but those should not be affected unless they involve Ctrl-A (the only key intercepted by screen on top of the keys which are intercepted by the terminal subsystem (e.g. Ctrl-C)). They should work just the same way. Some of the shortcuts usually interpreted by that bash shell are Ctrl-A (inside screen, you must use Ctrl-A a) to move the cursor to the beginning of the edited command, and Ctrl-E (works inside screen just the same way as not inside screen) to move to the end.

I know it's sounds complicated, but it's really dead simple because a terminal is just a file that you can write bytes to and read bytes from. Here's an excellent article that covers many related things if you are interested: http://www.linusakesson.net/programming/tty/index.php

To concern e.g. the Ctrl-D (a key combination supposed to be interpreted by the shell) issue, you should check that the characters generated by Ctrl-D are the same both on a gnome-terminal and a screen-terminal. You can see the character for example with cat. I suspect that they are indeed the same (it is so on my system), and if yes, that means that screen launched another shell than gnome-terminal normally does. In this case, find out what shell is launched by a gnome-terminal natively, and launch this shell (with same command-line arguments) in your screen-session, too.

0

One word: Byobu

I started using about a year ago and will not go back to anything else.

It's basically a fully customizable front-end for screen. http://en.wikipedia.org/wiki/Byobu_%28software%29

Byobu (software) From Wikipedia, the free encyclopedia Jump to: navigation, search Byobu Terminal screen of nijaba.png Byobu Developer(s) Dustin Kirkland (see full Authors list Initial release 2009 Written in sh, python Operating system Linux, Unix-like Type Command line interface License GNU General Public License v3 Website http://launchpad.net/byobu

Byobu is an enhancement for the terminal multiplexers GNU Screen[1] or tmux[2] that can be used to provide on screen notification or status as well as tabbed multi window management. It is aimed at providing a better user experience for terminal sessions when connecting to remote servers. History

The idea of Byobu came during a session at an Ubuntu Developer Summit when the developers were looking for a way to simplify the on screen notification of an administrator connected to a server.[3]

It was originally written for Ubuntu[4][5] and has since then be ported to multiple other Linux distributions[6][7] and other Unix-like operating systems.[8] Version 1.0 was done under the name Screen Profiles. The project was renamed to Byobu for its 2.0 release.[9] Byobu 3.0 reworked the build system to use automake and allow for porting to other UNIX operating systems. Byobu 4.0 introduced screen splitting, reworked the status notification system, and added support for tmux profiles. The most significant change that Byobu 5.0 introduces is a shift from GNU Screen to Tmux as the default backend. You can still run Byobu in Screen-mode, but the default experience now uses Tmux[10].

As of the Ubuntu 11.10 release, all Ubuntu cloud instances initial shell default to running in a Byobu environment.

4
  • 1
    Sounds good. I've upvote, but I don't have enough credit yet :)
    – lonestar21
    Jun 28, 2012 at 21:25
  • ... you could select this as the correct answer ;)
    – ZnArK
    Jun 28, 2012 at 21:31
  • I don't know byobu, but it's certainly not an answer to the question.
    – Jo So
    Jun 29, 2012 at 14:11
  • @JoSo ...I disagree sir. Get to know byobu then tell me it's not an answer to the question... :b
    – ZnArK
    Jun 29, 2012 at 15:43
0

The Problem

You have a number of choices when it comes to terminal muxers, but none of them will behave exactly like your shell.

A Graphical Solution

Screen and tmux (and by extension, byobu) are probably the wrong choice for you if you want them to be replacements for using Bash inside gnome-terminal. So, you might as well just do that.

VNC gives you an X Windows environment that is detachable and resumable, so you get all the robustness of a terminal muxer, but you get a full windowing environment as well. You can run your terminal emulator of choice, use your normal Bash keyboard settings, and your mouse will work the way you expect.

See Also

0

You must log in to answer this question.

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