Fork a Process Attached to my Terminal

So I was dinkering around in my terminal one day and thought I had one program running in the background, when really it was gedit. The first instance of gedit will of course, block my terminal, and I won't be able to use the terminal because it's attached to the GUI.

If I wanted my terminal back, I could always Ctrl+Z and go on about my day - but wait, gedit is frozen and I can't use it unless I return my terminal to it by running "fg". Ok, I can close gedit and lose all my tabs, or save my state in a session, and proceed to "gedit &" to run a fork in the background. That's annoying though.

So, I saw this and it dawned on me what's going on in the details:

gedit top.sls 2> /dev/null > /dev/null
[1]+ Stopped gedit top.sls 2> /dev/null > /dev/null

Wait, so the process is "Stopped" ??!? >_>
root@localhost:/srv/salt#ps faux|grep gedit
root 29482 0.8 0.5 359648 40576 pts/0 Tl 13:30 0:16 | \_ gedit top.sls

root@zynx:/srv/salt#kill -SIGCONT 29482
And voila!!!
Gedit was back in focus and ready to go!!!
That's the key - if you accidentally fg your apps in your terminal, you can always Ctrl+Z; kill -SIGCONT to return them as they were.



Popular posts from this blog

Setup and Install Monero(d) -- p2pool -- xmrig

Build xmrig on Linux

Perl Net::SSH2::SFTP Example