1

I am a linux newbie so this maybe a very stupid question, I will try to ask my question by giving an example. When I execute command in terminal

chromium-browser

chromium opens up but I cannot close the terminal without closing the browser. when I quit the terminal browser closes automatically So I wanted know how to close that terminal without closing the browser.

Shubh
  • 21
  • 2
  • 1
    Related: [Running programs in the background from terminal](https://askubuntu.com/questions/106351/running-programs-in-the-background-from-terminal) and [How to open an application in terminal and detach it?](https://askubuntu.com/questions/264257/how-to-open-an-application-in-terminal-and-detach-it) – steeldriver Jun 19 '20 at 12:30

3 Answers3

3

You can do it by running something like this from the terminal:

chromium-browser &
disown

You need to disown the program from the terminal.

More information about disown:

~$ disown --help
disown: disown [-h] [-ar] [jobspec ... | pid ...]
    Remove jobs from current shell.
    
    Removes each JOBSPEC argument from the table of active jobs.  Without
    any JOBSPECs, the shell uses its notion of the current job.
    
    Options:
      -a    remove all jobs if JOBSPEC is not supplied
      -h    mark each JOBSPEC so that SIGHUP is not sent to the job if the
            shell receives a SIGHUP
      -r    remove only running jobs
    
    Exit Status:
    Returns success unless an invalid option or JOBSPEC is given.
Terrance
  • 39,774
  • 7
  • 116
  • 176
2

You need to disassociate the browser from the terminal. I think this is the sequence:

chromium-browser </dev/null >/dev/null 2>&1 &
# or
nohup chromium-browser &

disown
exit
glenn jackman
  • 17,625
  • 2
  • 37
  • 60
1

Place an & after any command you want to run in background after the terminal exits.

chromium-browser &

should do the trick.
Reference to StackOverflow question explaining it

Dennis
  • 2,443
  • 2
  • 25
  • 42