- How do I force detach Screen from another SSH session?
- 3 Answers 3
- Short answer
- Explained answer
- Attaching to and detaching from screen sessions
- Screen is a «must» tool for Unix Administrators
- Introduction
- Authodetach capability
- Detaching and reattaching
- To join a screen that is already attached
- Naming screen sessions
- Summary
- NEWS CONTENTS
- Old News 😉
- [Dec 12, 2019] command line — Reattaching to an existing screen session — Ask Ubuntu
- [Nov 02, 2018] How to Recover from an Accidental SSH Disconnection on Linux RoseHosting
- [Solved] screen autodetach problem
- [Jan 23, 2012] A guide to GNU Screen by Steve ‘Ashcrow’ Milner and Anderson Silva
- [Oct 19, 2010] Make GNU Screen Your Default Shell
- [Oct 19, 2010] Taking Command of the Terminal with GNU Screen by Joe ‘Zonker’ Brockmeier
- [Jun 27, 2010] Screen — s5h.net
- [Jun 27, 2010] switching from gnu screen to tmux (updated)
- [Sep 15, 2009] The Many Uses of Screen By Juliet Kemp
- [Jul 11, 2009] Screen (vim + gnu screen) — Start gnu screen w- your vim session and a split shell + send commands to the sh vim online
- [Jul 8, 2009] Useful Tricks With Screen
- [Jul 7, 2009] tmux 0.9
- Red Hat Magazine A guide to GNU Screen
- [June 1, 2009] Screen – Manages multiple sessions on one terminal Ubuntu Geek
- [Feb 12, 2004] Curiosity is bliss Essential utility screen
- macosxhints.com — Use ‘screen’ as a serial terminal emulator
- Continued.
- Recommended Links
- Google matched content
- Softpanorama Recommended
- Top articles
- Sites
- Red Hat Magazine A guide to GNU Screen
- User Manual
- Reference
- Manpage
- [GNU screen manpage]
- Command line options
- Random Findings
- dtach — A program that emulates the detach feature of screen
How do I force detach Screen from another SSH session?
I had Screen running inside an SSH session. Terminal froze. After restarting Terminal, that Screen session still thinks it’s attached. Maybe it is. Perhaps I don’t really know what that means.
I’d like to attach to that Screen session from a fresh SSH login. I do not want to kill that Screen session as important things are happening over there. : )
The options I think I have ( none of which I know how to solve ):
- How do I detach that Screen session?
- How do I kill the SSH session that that Screen session is attached to?
3 Answers 3
As Jose answered, screen -d -r should do the trick. This is a combination of two commands, as taken from the man page.
screen -d detaches the already-running screen session, and screen -r reattaches the existing session. By running screen -d -r , you force screen to detach it and then resume the session.
If you use the capital -D -RR , I quote the man page because it’s too good to pass up.
Attach here and now. Whatever that means, just do it.
Note: It is always a good idea to check the status of your sessions by means of «screen -list».
try with screen -d -r or screen -D -RR
Short answer
- Reattach without ejecting others: screen -x
- Get list of displays: ^A * , select the one to disconnect, press d
Explained answer
Background: When I was looking for the solution with same problem description, I have always landed on this answer. I would like to provide more sensible solution. (For example: the other attached screen has a different size and a I cannot force resize it in my terminal.)
Note: the display may also be called:
- «user front-end» (in at command manual in screen)
- «client» (tmux vocabulary where this functionality is detach-client )
- «terminal» (as we call the window in our user interface) /depending on
1. Reattach a session: screen -x
-x attach to a not detached screen session without detaching it
2. List displays of this session: PREFIX *
It is the default key binding for: PREFIX :displays . Performing it within the screen, identify the other display we want to disconnect (e.g. smaller size). (Your current display is displayed in brighter color/bold when not selected).
Using arrows ↑ ↓ , select the targeted display, press d If nothing happens, you tried to detach your own display and screen will not detach it. If it was another one, within a second or two, the entry will disappear.
Press ENTER to quit the listing.
Optionally: in order to make the content fit your screen, reflow: PREFIX F (uppercase F)
Excerpt from man page of screen:
Shows a tabular listing of all currently connected user front-ends (displays). This is most useful for multiuser sessions. The following keys can be used in displays list:
- mouseclick Move to the selected line. Available when «mousetrack» is set to on.
- space Refresh the list
- d Detach that display
- D Power detach that display
- C-g , enter , or escape Exit the list
Источник
Attaching to and detaching from screen sessions
Screen is a «must» tool for Unix Administrators
Introduction
GNU Screen is a simple, but at the same time flexible and programmable windows manager. It is often called terminal multiplexer, but the key functionality of screen is in the area of windows management: creation, destruction and resizing of windows. For example it can split the console screen horizontally and display two windows at the same time. Screen is a Unix program (Cygwin version exists and is quite usable). For good Windows terminal emulator see Teraterm
Authodetach capability
One of the most important) feature of screen is that like VNC it provides the ability to detach the terminal emulator from the running programs and then reattach the same or new terminal to them.
Autodetach setting might not be enabled by default so it make sense to put a corresponding directive in your .screenrc
Detaching and reattaching
You can detach just by closing the terminal emulator that contains the session. Neither of these actually end your session. All they do is unbind your session from the current terminal. All of the programs you started running within screen are still running.
To detach a session, use Ctrl-a d. If that’s the only session running (which is typical for novices) you can reattach with Ctrl-a r.
To reattach outside the screen type
You can also use the command:
If more than one session is detached, you’ll need to provide session PID that you can obtain by listing sessions with the command screen -ls
you can attach with just the pid i.e. screen -r 12345
To join a screen that is already attached
Will attach you to that screen. In this case you have two session for the same UserID. Both users have control so be careful.
Naming screen sessions
Assuming you want named sessions for clarity, you can name a session in screen by starting screen as:
You can then reattach to a session using:
or kill/quit a session using:
Summary
List available screen sessions
Reconnect to specific session
- If there is a single session only screen -x will suffice.
- Otherwise you need to provide the name of the screen session
Connect to specific session in «watching/spy mode»
If there is a single session only screen -x will suffice.
you can attach with just the pid i.e. screen -r 12345
Reattaching to session within the screen
If you have more than one session running, you will need to know the PID to attach or reattach to an existing session. To detach a session, use Ctrl-a d. If that’s the only session running, you can reattach with Ctrl-a r If more than one session is detached, you’ll need to run Ctrl-a r XXXXX where XXXXX is the PID.
Dr. Nikolai Bezroukov
Top Visited Your browser does not support iframes. NEWS CONTENTS
Old News 😉
[Dec 12, 2019] command line — Reattaching to an existing screen session — Ask UbuntuJan 01, 2013 | askubuntu.comJohnMerlino , 2013-06-01 01:39:54
Now I want to reattach to the session running that process. So I start up a new terminal, and type screen -r But how do I know which one is the session running that process I created? Now one of the documents I came across said: «When you’re using a window, type C-a A to give it a name. This name will be used in the window listing, and will help you remember what you’re doing in each window when you start using a lot of windows.» The thing is when I am in a new screen session, I try to press control+a A and nothing happens.
You can customize the session names with the -S parameter, otherwise it uses your hostname (teamviggy), for example: (ctrl-A d to detach) (ctrl-A d to detach) As a bonus, you can use an unambiguous abbreviation of the name you pass to -S later to reconnect: (I am reconnected to the myprogramrunningunderscreen session)
worked for me. It detached the previous screen and allowed me to reattach. See the Man Page for more information.
Then once you are running screen, you can get a list of all active screens by hitting Ctrl-A » (i.e. control-A followed by a double quote). Then you can just select the active screens one at a time and see what they are running. Naming the screens will, of course, make it easier to identify the right one. Just my two cents
This creates the new screen session where I can build up the environment. This is what I use subsequently to reattach to that screen session. The nifty bits are that if the session is attached elsewhere, it detaches that other display. Moreover, if there is no session for some quirky reason, like someone rebooted my server without me knowing, it creates one. Finally. if multiple sessions exist, it uses the first one. Also here’s few useful explanations from man screen on cryptic parameters there is more with -D so be sure to check man screen tilnam , 2018-03-14 17:12:06
You will get a list like this [Nov 02, 2018] How to Recover from an Accidental SSH Disconnection on Linux RoseHostingNov 02, 2018 | www.rosehosting.com. I can get a list of all previous screens using the command: And this gives me the output as shown here: As you can see, there is a screen session here with the name: To reconnect to it, just type: And this will take you back to where you were before the SSH connection was terminated! It’s an amazing tool that you need to use for all important operations as insurance against accidental terminations. Manually Detaching Screens When you break an SSH session, what actually happens is that the screen is automatically detached from it and exists independently. While this is great, you can also detach screens manually and have multiple screens existing at the same time. For example, to detach a screen just type: And the current screen will be detached and preserved. However, all the processes inside it are still running, and all the states are preserved: You can re-attach to a screen at any time using the «screen -r» command. To connect to a specific screen instead of the most recent, use: Changing the Screen Names to Make Them More Relevant By default, the screen names don’t mean much. And when you have a bunch of them present, you won’t know which screens contain which processes. Fortunately, renaming a screen is easy when inside one. Just type: We saw in the previous article that «ctrl+a» is the trigger condition for screen commands. The colon (:) will take you to the bottom of the screen where you can type commands. To rename, use: And now when you detach the screen, it will show with the new name like this: Now you can have as many screens as you want without getting confused about which one is which! If you are one of our Managed VPS hosting clients, we can do all of this for you. Simply contact our system administrators and they will respond to your request as soon as possible. If you liked this blog post on how to recover from an accidental SSH disconnection on Linux, please share it with your friends on social media networks, or if you have any question regarding this blog post, simply leave a comment below and we will answer it. Thanks! [Solved] screen autodetach problemThe FreeBSD Forumskattenjanson screen autodetach problem I have come across a rather annoying problem running screen under FreeBSD. It seems that whenever I forget detaching the session properly (I usually ssh from a windows machine using putty), it runs for a few hours after which session hangs. When running screen -ls, the session is listed as attached. Doing screen -D sometimes generates the output that screen has been power-detached, although when I run screen -ls once more — it lists the session as still attached. I have of course read the manual but no option seems to help (been trying a few different flags for resuming screen). My .screenrc is a rather simple one (i.e, the only thing I have changed from defaults is the status bar and button-bindings). I am usually able to solve these problems myself and I have been looking through forums and googled the issue but I am unsure how to proceed troubleshooting. Any advice or the like would be greatly appreciated! ——————————————————————————— kattenjanson #2 March 1st, 2011, 23:03 I don’t bother detaching the other session, just use screen -x. gordon@ #3 March 2nd, 2011, 10:28 Yes, I have tried this as well, although to no avail. It seems that the same problem occurs under archlinux. I might have used the wrong topic, btw. The real issue is that when not detaching properly, the session runs for about 4 or 5 hours then dies. I noticed this when my irssi session pinged out after about the same time. What happens is, I cannot attach the session at all after this has happened. kattenjanson #4 March 3rd, 2011, 11:21 Code: How are you closing the connection? mix_room #5 March 4th, 2011, 20:21 The sessions are mainly closed when the lid on my laptop is closed it seems that screen -x works a bit better than screen -Dr or -dr btw. Not without problems, though, as the problem with irssi persists. When im able to resume the session, alot of the time irssi has simply stopped working and doesnt accept input. When i kill the «window» in which irssi is running, the other «windows» in screen seems to completely stop responding as well (even though they accepted input before killing the irssi-window). I realize that this is not a great problem since having a irc-session running 24/7 might not be the most important thing, but i am rather curious as to why this is happening. kattenjanson #6 March 4th, 2011, 20:46 Some people mention sysutils/tmux as a new alternative to sysutils/screen. wblock@ #7 March 4th, 2011, 21:30 I like tmux better than screen.There is a pretty good tutorial online that even has purty pictures. bes #8 March 7th, 2011, 11:57 Thank you very much for the help, all of you, greatly appreciated! Tmux works very well. [Jan 23, 2012] A guide to GNU Screen by Steve ‘Ashcrow’ Milner and Anderson SilvaOctober 5, 2007 Red Hat MagazineSharing a session with others Another great application of Screen is to allow other people to login to your station and to watch the work you are doing. It is a great way to teach someone how to do things on the shell. Setup to allow screen to be shared
Connecting to the shared screen:
And now both users (from the host and guest) will be sharing a screen session and can run commands on the terminal. Working from multiple locations Let’s say you have a screen session open at work with X number of windows on it. Within those screens you may be running an IRC client, an SSH connection to the web server, and your favorite text-based email client. It’s 5 p.m. and you have to go home, but you still have work left to do. Without Screen you would probably go home, VPN into your company’s network, and fire up all the shells you need to keep working from home. With Screen, life gets a little easier. You can simply SSH into your workstation at work and list your available screen sessions with the command: And connect to the sessions you were running at work with the command: This way screen will let you pick things up exactly from where you left off. Applications to make Screen your window manager Now that you have seen what Screen can do for you, you probably are wondering how to make it your main interaction point, like a terminal window manager. Let’s start with IRC, a very common and popular chat system. Instead of using a graphical client like Pidgin, install Irssi. Irssi sports a slick console interface, tons of add-ons and scripts, and can be enhanced with Perl. It’s even theme-able! Another important part of any user’s setup is email. Today most people use graphical clients such as Thunderbird, Evolution, or Sylpheed. My favorite client happens to run in a terminal: Mutt. While Mutt isn’t the easiest client in the world to set up, it sure is a joy to use. You can even use your favorite console text editor for doing emails. Speaking of favorite text editors, there is a good chance that you work on some code projects or configurations. Instead of using gedit/kedit or powering up a heavy IDE such as Eclipse, you can pick up on Vim. Vim is a powerful text editor which, as is stated on the Vim website, could be considered an entire IDE in itself and sports syntax coloring in over 200 programming languages. If Vim doesn’t fit your style, there is always emacs, nano, or JOE. Now all you need you need to do is edit your /.screenrc to meet your needs. /.screenrc looks like the following: Once you get used to the shortcuts in GNU screen, not only will your desktop become more organized (due to the lower number of open windows), but your efficiency as a developer or system administrator will increase not only at work but at your home office as well.
According the documentation this should be possible with the «at» command, but I don’t get it to work. So the command sequence: OTOH according the TODO file at: Hopefully someone reading this article knows how to use the at command.
Thanks goes to Michael, (one of the screen devs) who provided this information to me.The command above should read: double quote ls backslash zero twelve double quote. Somehow the parser removes the blackslash zero. One more try:
P.S. I think there are two mistakes in the example given. Again, this is my first foray in screen’s string escapes, so I might be way off. I think «%<=kw>» should have a space, as «%<= kw>«. Without this change on my system windows before the current are green instead of white. I also think there is an extra «%?» before the the closing «]» on the window list. This made no difference on my system. Here’s a version with these changes.
The few modifications I’ve made are to increase the MAXWIN param to allow for more windows, and change the command key to ^w so I don’t have to unlearn my emacs ^a habits.
[Oct 19, 2010] Make GNU Screen Your Default ShellGeorge’s tip actually makes a lot of sense ! In Linux you can put in cron an automatic restart of screen in case of reboot using @reboot.October 18 2010 | ServerWatch.com
george >: -[This is an interesting idea —NNB]
Instead, I first login and create a screen session called main using screen -S main I have the end of my .bash_profile set to run screen -D -R main. That way whenever I log in it’ll automatically Disconnect then Reconnect my screen session — bingo bango bongo — only one screen session running at a time. As a funny bonus I now know everytime the server’s rebooted because my main screen session goes away and I have to restart it.
On my office workstation I also launch screen this way, but since I often login to it remotely (unlike my laptop) I also check to see if SSH_CONNECTION is zero-length: [ -z «$STY» ] && [ -z «$SSH_CONNECTION» ] && screen This means I still need to launch screen manually when logging in remotely, but I often leave a screen session running on my workstation (because I’m in the middle of something) and resume it once I login.
Screenie is a small and lightweight GNU screen(1) wrapper that is designed to be a session handler that simplifies the process of administrating detached jobs by providing an interactive menu. I actually use a combination of environment variables and bash aliases to make `irssi` launch or reconnect an in-screen instance of irssi; similarly, `rtorrent` launches or reconnects an in-screen instance of rtorrent. I also have a main screen session that opens when I just type `screen`, maybe I’ll start launching/reconnecting that one at login through .bashrc like you suggest. If you’re interested, in my method: http://pbrisbin.com/posts/screen_tricks/ [Oct 19, 2010] Taking Command of the Terminal with GNU Screen by Joe ‘Zonker’ BrockmeierFebruary 11, 2010 | linux.comAttaching and Detaching from Screen One of the most powerful features of screen is the ability to detach and attach to running sessions. If you tend to work from several machines, it might be a good habit to start an instance of screen when you log in. Then if you’re at a different system you can simply attach or re-attach to the running session and resume where you left off. Note that you can also share a screen session, so it’s not necessary to detach from a session in order to log into the same session from another location. So, for example, if you’ve logged into a system remotely using SSH and then started a screen session, you could then go to another computer and attach to the same session. To see which sessions are running, use screen -ls. This will display all running sessions, and the process IDs (PIDs). If you have more than one session running, you will need to know the PID to attach or reattach to an existing session. To detach a session, use Ctrl-a d. If that’s the only session running, you can reattach with Ctrl-a r If more than one session is detached, you’ll need to run Ctrl-a r XXXXX where XXXXX is the PID. To connect to a session that’s still attached, use Ctrl-a x XXXXX instead. This will let you re-attach to an existing session without any problems. Can I have a Copy of That? Want a quick and dirty way to take notes of what’s on your screen? Yep, there’s a command for that. Run Ctrl-a h and screen will save a text file called «hardcopy.n» in your current directory that has all of the existing text. Want to get a quick snapshot of the top output on a system? Just run Ctrl-a h and there you go. You can also save a log of what’s going on in a window by using Ctrl-a H. This will create a file called screenlog.0 in the current directory. Note that it may have limited usefulness if you’re doing something like editing a file in Vim, and the output can look pretty odd if you’re doing much more than entering a few simple commands. To close a screenlog, use Ctrl-a H again. Note if you want a quick glance at the system info, including hostname, system load, and system time, you can get that with Ctrl-a t. Simplifying Screen with Byobu If the screen commands seem a bit too arcane to memorize, don’t worry. You can tap the power of GNU Screen in a slightly more user-friendly package called byobu. Basically, byobu is a souped-up screen profile originally developed for Ubuntu. Not using Ubuntu? No problem, you can find RPMs or a tarball with the profiles to install on other Linux distros or Unix systems that don’t feature a native package. Note that byobu doesn’t actually do anything to screen itself. It’s an elaborate (and pretty groovy) screen configuration customization. You could do something similar on your own by hacking your /.screenrc, but the byobu maintainers have already done it for you. Since most of byobu is self-explanatory, I won’t go into great detail about using it. You can launch byobu by running byobu. You’ll see a shell prompt plus a few lines at the bottom of the screen with additional information about your system, such as the system CPUs, uptime, and system time. To get a quick help menu, hit F9 and then use the Help entry. Most of the commands you would use most frequently are assigned F keys as well. Creating a new window is F2, cycling between windows is F3 and F4, and detaching from a session is F6. To re-title a window use F8, and if you want to lock the screen use F12. The only downside to byobu is that it’s not going to be on all systems, and in a pinch it may help to know your way around plain-vanilla screen rather than byobu. For an easy reference, here’s a list of the most common screen commands that you’ll want to know. This isn’t exhaustive, but it should be enough for most users to get started using screen happily for most use cases.
Finally, if you want help on GNU Screen, use the man page (man screen) and its built-in help with Ctrl-a :help. Screen has quite a few advanced options that are beyond an introductory tutorial, so be sure to check out the man page when you have the basics down. [Jun 27, 2010] Screen — s5h.netIt took a while but I thought there would be a way to send some data to a pts to prevent it from timing a session out, although this path proved too complex through /dev/pts and unfruitful for me. GNU Screen does have a mechanism to do this however, though -X. For example, from cron, I’ve configured this, to send the .info command to a screen session: This, tells the session named ‘talker‘ to stuff the text ‘.info’ into the session. Replace ^U and ^M with ctrl-v followed by u/m (carriage return character), this simulates the user clearing the line and typing .info followed by the return key. Automation can be further enhanced though the -p argument. Screen makes it very handy if you want to automate both the left and right hand site of an application (simulate the user and server). Scroll back isn’t as friendly as in vim, but there is some overlap with the key strokes
Suppose you want a set of sessions created to various hosts, one way to do that might be something along the lines of: This will create three sessions to host[1..3] with the title of host[1..3]. This is perhaps one of the most useful features that I’ve found with screen (besides all the other useful things of course). There is a maximum of 40 windows allowed with the default build of screen. If you want to change this, reconfigure your screen build with -DMAXWIN=255, or edit the config and set the MAXWIN there. When using the screen command it might be worth noting the following very useful parameters
In the previous example we have a number of screen windows with title host1. Should you wish to select for example host1 and list a file, then write something to the terminal you might do something like this: I hope this gives you an idea of how even more useful screen can be than it first appears! I often use pre-selection when the window list cannot be searched through, for example rather than scan through 40 window titles with my eye balls I can drop out of the screen session and use screen -r -p name to jump to the window title name. [Jun 27, 2010] switching from gnu screen to tmux (updated)Linuxupdate #1: upstream accepted my patch, so the next tmux release will provide window-status-alert- update #2 [2010/05/17]: uploaded my updated config file, now using ` as my prefix key I gave tmux a try yesterday. Clean config file, thorough documentation and a few nice touches here and there (i.e. better, persistent window splitting) make it a nice alternative to screen, but the biggest difference lies in memory usage. Screen can easily eat up to 40-50mb with just a few windows open, but tmux has yet to reach the 10mb mark! You may argue that ram is cheap these days, but when you’re on a 360mb VPS ram matters I did find a few bugs/annoyances, for instance if you add set-option -g default-terminal «screen-256color» in your config file, tmux stops evaluating the #T variable. I hacked my way out of this one by adding the following in my .bash_profile instead: [[ $TERM == «screen» ]] && export -p TERM=»screen-256color» Turns out that’s not tmux’s fault but bash’s, I’ll have to create a patch for that as well If you have the same issue, you can use the above hack as a temporary fix. Also version 1.2 does not provide a way for you to customize the colors used on window titles with alerts (either monitored or when the bell is active), but I patched that and sent it upstream You can find an ebuild with the patch in my overlay, wirelay (layman -a wirelay ). The patch was accepted upstream so it’ll be in the next release.
unbind-key C-b # we might need ` at some point, allow switching # 0 is too far from ` # set-option -g default-terminal «screen-256color» setw -g mode-keys vi bind e previous-window set-option -g status-utf8 on set-option -g pane-active-border-fg green set-option -g message-fg black #setw -g mode-bg black setw -g window-status-bg black set -g status-left ‘#[fg=red]#H#[fg=green]:#[fg=white]#S #[fg=green]][#[default]’ # set -g status-right ‘#[fg=green]][#[fg=white] #T #[fg=green]][ #[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]’ set -g history-limit 4096 # `+r reloads the configuration, handy Selected Comments
1) Tmux doesn’t support mouse dragging. If you use Vim in Screen you can «set ttymouse=xterm2″ in .vimrc and you can drag visual selections and have them show up in your X copy buffer, and it defines a protected region for the area you actually want to select. You can even drag to resize vim’s split windows. None of that works in Tmux. If you do vertical splitting, tmux it selects text from both sides of the split, and with line numbering on it selects the numbers unless you :set nonumber. Yes, just like screen Tmux has it’s own copy/paste system – but it’s slow to use. You end up with 3 different buffers for X, Screen, and your editor and it becomes a pain especially when working from putty. 2) Tmux handles windows very differently from screen. What Vim calls «tabs», tmux calls «windows», what Vim and screen call «windows», tmux calls «panes», and what Vim and Screen call «buffers», tmux has no equivalent – which is has been a huge pain in the ass until possibly the latest version of Tmux which added the join-pane command which I haven’t tried since it was released. Still, I find working with it in that way a bit unnatural. Clearly Tmux looks like the better long-term solution. It’s configuration actually makes sense and it’s session handling are superior to screen. Screen development is stalled and the live ebuild from the berkano overlay with the vertical split patch hasn’t been building for the last 6 months or so. Since switching to xmonad as a tiling wm really the only thing I need is the detachable sessions support, which Screen does just fine.
Join-pane and break-pane work as advertised in 1.2. I don’t use splitting much on localhost either, since I’m using the awesome window manager, but splitting is very useful when doing work over ssh
I tried turning mouse-select-pane off. I had a chat with one of the tmux devs on irc a few months ago and apparently the problem is simply that they don’t implement that yet. My workaround was setting a hotkey in vim to turn line numbers on and off so it’s possible to copy/paste between a browser window without having to abuse xclip too much. I didn’t realize Screen was that hard on resources either. Kinda stinks. I’ve been using Konsole too which apparently isn’t so lightweight. I like it though since I have kde installed anyway and has always worked flawlessly.
alias mytmux=»tmux a -d || tmux» The biggest memory saving I made on my machine recently was switching away from gnome-terminal to urxvt(d). I’ve never really noticed much of a memory issue with screen although I do wish it was easier to script/configure. I shall check out tmux when I next have a spare few hours
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD Its size is 100Ч25, four bash/dash sessions plus one mc session, no /.screenrc, the default /etc/screenrc has defscrollback 1000. The system runs gentoo on a Geode LX processor.
nice seeing you switching to tmux too
How did you measure the RAM usage? Did you have the same scrollback in tmux as screen?
All of the stuff at that link is possible in tmux and is often much easier… [Sep 15, 2009] The Many Uses of Screen By Juliet KempSeptember 11, 2009 | ServerWatch.comMonitor a window for output: Hit Ctrl-A Shift-M when in window 1, and then flip to window 2 (with Ctrl-A N), and you’ll be notified in window 2 when there’s output in window 1. This is useful if you’re running a job that takes a long time; no need to keep flipping between windows. You can also monitor for silence with Ctrl-A _. This is useful if you’re running a compile job or something else that outputs a lot of stuff when it’s running successfully. By berto September 15 2009 2:26 PMPDT :: cat .screenrc defscrollback 1024 screen -t rOOt 0 su — [Jul 11, 2009] Screen (vim + gnu screen) — Start gnu screen w- your vim session and a split shell + send commands to the sh vim onlineNote: gvim is not supported. You must be running vim in a console. Currently tested on Linux and cygwin, but should work on any unix based This plugin aims to simulate an embedded shell in vim by allowing you to Commands: Note: If you are already in a gnu screen session, then only steps :ScreenSend — Send the visual selection or the entire buffer contents to the running gnu screen shell window. :ScreenQuit — Save all currently modified vim buffers and quit gnu An example workflow may be: Decide you want to run all or pieces of the code in an interactive Send code from a vim buffer to the shell: Quit the screen session and return to your original vim session: Gotchas: Download the script and put it in your plugin directory ( [Jul 8, 2009] Useful Tricks With Screen
You can also manually detach the screen, with screen -d (detach screen), or by hitting Ctrl-A then D while in a screen session. This leaves the screen running in the background, and it can be useful for running background jobs. Or you can leave a screen session connected to another machine: Run screen before you open the ssh session, then instead of logging out when you’re done, detach the screen, and then just reattach it ( screen -r ) when you need to connect to that machine again. The downside of this is that it does have security implications!
|