I ran scratch-text-editor in terminal, but now I want to close the terminal without closing scratch.

Is this possible, if so; how?

4 Answers 4


You can use:

  1. nohup

    nohup scratch-text-editor /path/to/file &

    Then close terminal with Ctrl+D

    If you want direct in single command: Use exit at the end of the command. like,

    nohup scratch-text-editor /path/to/file & exit
  2. setsid

    setsid scratch-text-editor /path/to/file ; exit
  3. disown

    scratch-text-editor /path/to/file & disown ; exit
  4. All in one command:

    (scratch-text-editor /path/to/file &) ; exit
  • @Tim please try your answer once again :)
    – Ravan
    Commented Nov 21, 2015 at 16:12
  • without nohup you cant stop process with just &
    – Ravan
    Commented Nov 21, 2015 at 16:13
  • btw @Tim since you are asking for command can I add alternative commands in my answer?
    – Ravan
    Commented Nov 21, 2015 at 16:23

In the future use this command:

scratch-text-editor /file/to/open.txt

for this:

scratch-text-editor /file/to/open.txt &

Note the & on the end there. That will start it as a separate process.

Now to close the terminal, simply hit Ctrl + D.

If you forget to use & then you can detach it. First press Ctrl + Z to suspend the program. This can crash some, but it is unlikely.

Then type bg to send it to background, and then press Ctrl + D as above.

As a side note, instead of bg you can use %. This simply brings it back into the terminal.

  • 1
    why Ctrl+D ?...........
    – Ravan
    Commented Nov 21, 2015 at 15:51
  • @Ravan D is for Detach? Or do you mean why not just close it? That will close the application too
    – user3
    Commented Nov 21, 2015 at 15:55
  • 1
    Actually in the first case you could still close the terminal. Go to the terminal and hit Ctrl+Z (suspend), then run 'bg' to resume the process in the background. Now you can use Ctrl+D as mentioned to close the terminal.
    – exelotl
    Commented Nov 21, 2015 at 15:59

Simply detach the process from terminal's process to its parent by: command-to-run & disown

  • Mind explaining the downvote?
    – psukys
    Commented Nov 21, 2015 at 21:43
  • 1
    The downvote was because this answer adds nothing - this is covered in previous answers.
    – user3
    Commented Nov 22, 2015 at 14:30

This should work with any app opened from the terminal.



After Scratch opens, type:

Ctrl + z

This will halt the process, but not close Scratch.

Next, type:


This will move Scratch's process to the background.

Now, finally type:


That's it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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