vdub Posted May 10, 2012 Share Posted May 10, 2012 (edited) This may be a really stupid question but I searched Google and could not find a way to do it. I know you can suspend sessions with Ctrl_s and resume with Ctrl_q but lets assume that I am away from my shop and I ssh in to run a command. I want to allow this command to continue running on the remote system when I exit ssh, so I don't want to suspend the session. However, I want to resume that ssh session in a terminal later on the physical system. Is that possible? Edited May 10, 2012 by vdub Quote Link to comment Share on other sites More sharing options...
Mr-Protocol Posted May 10, 2012 Share Posted May 10, 2012 Look into a program called "screen" Debian: apt-get install screen Quote Link to comment Share on other sites More sharing options...
vdub Posted May 10, 2012 Author Share Posted May 10, 2012 Look into a program called "screen" Debian: apt-get install screen You know I saw that but for some reason thought that it was meant for individual commands. I want to be able to restore the entire session. I will read the man page and play around with it. Thanks. Quote Link to comment Share on other sites More sharing options...
bobbyb1980 Posted May 11, 2012 Share Posted May 11, 2012 Screen is what you want. Should be installed on Ubuntu and Ubuntu server by default (if not sudo apt-get install screen). screen = Create new screen session CTRL-ALT-D = Detach session Then you can close the SSH session or let it die. SSH back in when you want to regain axx and type "screen -ls" and locate your session. Then type "screen -r sessionname" and viola. Quote Link to comment Share on other sites More sharing options...
vdub Posted May 11, 2012 Author Share Posted May 11, 2012 Screen is what you want. Should be installed on Ubuntu and Ubuntu server by default (if not sudo apt-get install screen). screen = Create new screen session CTRL-ALT-D = Detach session Then you can close the SSH session or let it die. SSH back in when you want to regain axx and type "screen -ls" and locate your session. Then type "screen -r sessionname" and viola. That works great, thanks However, Its Ctrl+a+d to detach. It would be nice if you could tab complete the session name rather then typing it in but the plus side is if you only have one detached session you only have to type screen -r to attach to it. Quote Link to comment Share on other sites More sharing options...
Sitwon Posted May 11, 2012 Share Posted May 11, 2012 That works great, thanks However, Its Ctrl+a+d to detach. It would be nice if you could tab complete the session name rather then typing it in but the plus side is if you only have one detached session you only have to type screen -r to attach to it. You can highlight the name and middle-click to copy it. Or when you create the Screen session you can name it with 'screen -S <name>' and then resume it with 'screen -r <name>'. Quote Link to comment Share on other sites More sharing options...
int0x80 Posted May 13, 2012 Share Posted May 13, 2012 Look into screen or tmux. I have this alias in my ~/.bash_aliases for when I connect and want to re-attach: alias screenr="screen -raAd" Quote Link to comment Share on other sites More sharing options...
redhook Posted May 14, 2012 Share Posted May 14, 2012 However, Its Ctrl+a+d to detach. CTRL+A-D actually. You can also do CTRL+A-C to create a new terminal while in screen and CTRL+A-N/P to switch to the next/previous terminal. Look through the manual for all the commands. Quote Link to comment Share on other sites More sharing options...
vdub Posted May 15, 2012 Author Share Posted May 15, 2012 Look into screen or tmux. I have this alias in my ~/.bash_aliases for when I connect and want to re-attach: alias screenr="screen -raAd" I will have to look at that. Does that set a default alias for the screen session? CTRL+A-D actually. You can also do CTRL+A-C to create a new terminal while in screen and CTRL+A-N/P to switch to the next/previous terminal. Look through the manual for all the commands. Yeah, I saw there where tons of shortcuts. Quote Link to comment Share on other sites More sharing options...
01000010 Posted May 16, 2012 Share Posted May 16, 2012 (edited) Screen is pretty sweet but after the hak5 irc channel suggested byobu I will never go back to just screen. Its pretty much the same but with an easy to setup ui. Edited May 16, 2012 by leapole Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.