Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 19603  / 2 Years ago, thu, june 30, 2022, 10:10:44

If I'm running a program in bash, I can suspend it by pressing Ctrl+Z. If I want to leave the program running, I can then use the bg command. Is there some way to directly put the program in the background, without having to type bg?



Clarification: I want to put the program in the background when it is already running, without suspending it.


More From » bash

 Answers
0

I do not think it is possible to move a running program to background(while the process is still in running state).

However there is an application called GNU-Screen,using which you can run any number of console-based applications--interactive command shells, curses-based applications, text editors, etc.--within a single terminal.

Here is a nice tutorial on GNU-Screen.

Note that it does not do exactly what you asked,but serves the purpose anyway.

Example:

Here is the implementation of what you asked using GNU-Screen.




  1. Run screen

    You will get details about the software.Press return.

  2. Now,you will see your normal terminal.However it is a window of screen.Type any command say vlc. It will start the process within that window.

  3. Now to open a new window type Ctrl+A and then C.You can run a new command here.Note that the process which you started in window 1 is still running.

  4. To detach from screen press Ctrl+A and then D.You now return back to your old termianl.However any process that you started from screen would still be running.


[#35626] Friday, July 1, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
percol

Total Points: 493
Total Questions: 116
Total Answers: 107

Location: Taiwan
Member since Mon, Sep 6, 2021
3 Years ago
;