4 ms·
Any good resources for learning screen? So far I've only mastered: "Ctrl-a d" and "screen -r" I'd love to hear how you use screen, for example. Do you use mul
by fdb 15y ago
Any good resources for learning screen? So far I've only mastered:
"Ctrl-a d" and "screen -r"
I'd love to hear how you use screen, for example. Do you use multiple sessions or windows? Split screen?
- ordinary 15y agoYou're missing out. After (or maybe alongside) those two keys, I find the most useful ones are: Ctrl-a c (to create a new terminal) Ctrl-a 1 (to go to the first terminal) Ctrl-a 2 (second, etc) If you're an emacs user, you might also want to change the command key away from something as essential as the default bind for beginning-of-line. I myself use Ctrl-T. In .screenrc, that would be: escape ^Tt The screen manpage is also very good.
- dredmorbius 15y agoAdd to that list C-a " to view the list of screens. C-a A can be used to assign names to those screens. C-a [0-9] can be used to navigate directly to a specific screen. C-a C-a will swap the current and previous screen. C-a S splits the screen vertically C-a <tab> navigates to the next visible screen (there's no back-navigation). C-a q collapses all splits leaving the current screen visible. C-a d detaches from the screen session. There are some other features, but with these you're using much of the power of screen. Takes a few days to get used to, but it's one of those "how did I ever live without this" tools.
- nuclear_eclipse 15y agoI personally use screen in a relatively "simple" way. I don't use splits, but I do occasionally use `screen -x` to have multiple views of the same screen session. My biggest use of screen is for running a persistent Irssi session on my server, and connecting to that from whatever terminal or mobile device I happen to be sitting in front of. In that case, I have just a couple active windows, but only one that I use 95% of the time. I have a similar persistent screen session on my work machine for running Irssi's SILC client to chat with co-workers. I also use screen for my primary workflow, because a lot of my development takes place on servers. I'll start a screen session on each server, and create a new window for each type of task I'm performing. Eg, I have a window each for `htop`, mongodb console, vim, git, and for running the program I'm working on, plus a few others for one-off tasks like installing a new package or editing a system configuration file. Some tips I have include: - Set up a nice .screenrc file, and make yourself a customized "caption" line, which will give you a status bar of sorts that will list all your open windows. Mine is `caption always "%{= dd}%{+b ky}%{+ .b} $LOGNAME@%H %{-} %{.y}%-w%50>%{+ Kg} %n %t %{-}%+w%<%{-}"` - Similary, either get in the habit of naming your windows, or set up your shell to properly report commands to screen so it can automatically name them based on the command you've run. My zshell config does this for both screen and gnome-terminal: https://github.com/jreese/oh-my-zsh/blob/jreese/custom/screen-titles.zsh https://github.com/jreese/oh-my-zsh/blob/jreese/custom/scree... - Ctrl-a, Ctrl-a is a great combination for "alt-tabbing" between windows - I set my least-used window to #0, as it's the "hardest" number to hit after ctrl-a, and I put my most used windows between #1 and #5 for easy one-handed switching. - Ctrl-a Escape is the easiest way to get into copy mode to view your scrollback buffer. Ctrl-a [ is equivalent, but IMO using escape instead allows me to start moving my right hand to the cursor/paging keys while I'm still using my left hand to enter copy mode.
- aw3c2 15y agohttps://wiki.archlinux.org/index.php/Screen https://wiki.archlinux.org/index.php/Screen and http://en.gentoo-wiki.com/wiki/Screen http://en.gentoo-wiki.com/wiki/Screen are my go-to pages.
- pyre 15y agoscreen -x Attaches a currently running session without detaching it from where ever it's currently attached to. (Note: this can cause some issues if the currently attached session has a larger/smaller terminal). I've also mapped Ctrl-a to ` instead. This makes flipping between the most recent 'windows' as easy as `q. # Use backtick as the escape character. Use F11 and F12 to switch between ` and # C-o as the escape sequence. This is useful when pasting text to the terminal # that may contain backticks in the text. # # SOURCE http://superuser.com/questions/74492/whats-the-best-prefix-escape-sequence-for-screen-or-tmux escape \140\140 bindkey -d -k F1 escape ^O^O # bound to F11 bindkey -d -k F2 escape \140\140 # bound to F12 F11 swaps the escape sequence to C-o (useful for pasting things that might have a ` into the terminal) F12 swaps the escape back to ` Also: [escape] n -- cycle to the next window in the list [escape] p -- cycle to the prev window in the list [escape] " -- see the window list Turn off the startup message: startup_message off * Note: 'escape' doesn't refer to the Escape key, but to the key sequence that 'escapes' all screen key bindings (default: C-a).
- Estragon 15y agoinfo screen
- Estragon 15y agoNot sure why this was downvoted. "info screen" at the command line is exactly how I learned about all of screen's features.
- maw 15y agoThe choice of C-a as the Magic Screen Key Combo is unfortunate. I start my screen sessions thus: screen -e'^\\\'. This makes C-\ the Magic Screen Key Combo. C-\ has other meanings in some contexts, but in practice I've never used it. On the other hand, I use C-a lots, in Emacs and in shells. Also, if you plan to have more than one screen session, you can name them with -S <argument>. So: screen -e'^\\\' -S blahblah. You can reattach later: screen -Dr bla. If there's no ambiguity, you don't need to type out the full name.