As most of you know GNU Screen is a nice tool that enables you to do something like:
One other good use for the detach and reattach is as a console-mode "remote desktop" feature. You can detach from a screen session at work, shell into the machine from home, and reattach. Very, very handy. With a bit of extra work, you can even have a number of terminals all attached to the same session--great for collaborative efforts and meetings.
Now Im curious is there a way to do that without Screen. Aka instead of logut i type magiclogout and next time I login I get my old sesion(if OS hasnt reeboted ofc)
byobu is based on screen ; it has a menu option to make it your default shell.
You can either
exit
as normal or detach with alt-A, D as you would with plain screen, and your session will be waiting when you log in again.In addition it adds a number of keys for terminal management, F2 to create a new terminal, and F3 and F4 to move between windows, and a status bar with a number of useful indicators like outstanding package updates.
It's installed by default on Ubuntu Server builds, and rapidly becomes my default terminal on most servers I manage.
As I said, byobu depends on screen to work though... I'm not aware of any way of resuming a session other than having a process stay running on the target machine.
Edit : byobu will also wrap tmux (which is the default on newer versions of Ubuntu). You don't have to do anything in most cases - it will just use the default terminal multiplexer.
you might want to have a look at tmux
You could have something like this with a remote desktop software that create its own session, like for example FreeNX on the server and NoMachine client on the client.
You can also use this with server and client machine being the same machine, so as to simulate what you ask for.
This not possible without using screen, byobu (as mentioned by Adrian) or similar tools.
An interactive shell must be connected to a tty. If you logout, the shell looses the connection to the tty and exits.
Screen and friends avoid this by creating one or more persistent virtual ttys. When you logout, the shell remains connected to the virtual tty and does not notice that the user was disconnected.
For non-interactive programs, a tty is not required and instead of screen, you could use
nohup
.As Adrian points out, it is possible use byobu per default, and, as you know, many power users will just start
screen
as the very first thing they do after login. Is there a specific reason, you want to avoid screen?You can start a command via
nohup
:If you would like to have the output somewhere saved do
Now you have to detach the running software by
bg
disown %1
More hints to
nohup
can be found in its manpage (http://ss64.com/osx/nohup.html), same fordisown
(http://ss64.com/osx/disown.html).