-1

How to run example gedit without window (background mode)?

momo2047
  • 194
  • 1
  • 11

1 Answers1

0

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

  • 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