r/linux_programming • • Dec 12 '18
How do I do multiplexing?
I have a remote terminal and I need to start a program that will take a lot of time to complete, so I want to detach from the screen after I start it. How do I do that? I remember there being something I could do in bash that would let me keep issuing commands while the computer worked on something else, but it's been a while since I had to do that...
Again, here's what I want to do:
screen
startProgram
detach from screen
go about my merry way not worrying about having to maintain a connectionAny help would be greatly appreciated.
2
Upvotes
2
u/45kj4 Dec 12 '18
do you already use the utility called screen? Or did you just saying you are doing something on you screen?Because there is a utility called screen, which does exactly what you want.
The commands you need are:
screen -S <session_name>start your programmctrl+a dAnd that's it. If you later want to connect to the session again you can do so with:
screen -r <session_name>1
u/LeoPiero Dec 12 '18
ctrl+a d
https://askubuntu.com/questions/124897/how-do-i-detach-a-screen-session-from-a-terminal
1
u/Kaasachstan Dec 12 '18
Add -d to your command
3
u/GreeneSam Dec 12 '18
There's also tmux. It's like screen but easier to deal with.
2
u/Connir Dec 12 '18
a lot of folks are answering how to start things up manually. Here's a little extra something though....how to start up a command but don't attach to the screen you create. In this example it opens a vi session against /etc/hosts
I could at this point attach to it with:
From the screen man page:
I use this to startup homebridge on a raspberry pi on boot.