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

  • 2
    And what will gedit without a window? – muru Mar 28 '16 at 23:32
  • 1
    Why do you want to run Gedit without it opening a window? Gedit is literally a graphical text editor, and that's it. It doesn't do anything else. – TheWanderer Mar 28 '16 at 23:35
  • Gedit is a graphical application - as far as I know it can only run inside a window. – You'reAGitForNotUsingGit Mar 28 '16 at 23:37
  • If you're looking for a CLI app, try Nano – You'reAGitForNotUsingGit Mar 28 '16 at 23:37
  • Do you mean as a daemon? The man page for gedit makes no reference to that possibility. – DK Bose Mar 29 '16 at 4:02

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:

[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

| improve this answer | |
  • 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. – tu-Reinstate Monica-dor duh Mar 29 '16 at 3:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.