How to run example gedit without window (background mode)?
1 Answers
If you're running an app from the command-line, it runs in "foreground" mode and occupies the current shell until it ends.
$gedit myfile
To put a currently-running "foreground" app into the background, (i.e. The window still runs, but the shell returns) you first have to pause the process by pressing the key combination CTRL+z.
This will tell you it has paused the process and return you to a command prompt:
^Z
[1]+ Stopped gedit
$
At this point, gedit will be frozen because it is paused. You can see the paused process by calling jobs
.
$ jobs
[1]+ Stopped gedit
And you can then put the process into the background by calling bg %1
(or just bg
since it assumes the most recent process)
$ bg
[1]+ gedit &
$
As you see, gedit is now unfrozen, and the '&' indicates that it's running in the background.
You can shortcut all this messing about by simply adding the '&' to the end of the command you are calling, and it will return the new Process ID, e.g.
$ gedit myfile &
[1] 12882
$
For more information on process management, you might want to read one of the many excellent guides on the internet, such as this one: http://linuxcommand.org/lc3_lts0100.php

- 7,288
-
It's also important to note that, in the case of gedit and others, if you background gedit and then call it again, it will use the currently-running backgrounded process instead of creating a new one. – tudor -Reinstate Monica- Mar 29 '16 at 03:04
daemon
? The man page for gedit makes no reference to that possibility. – DK Bose Mar 29 '16 at 04:02