I ran scratch-text-editor
in terminal, but now I want to close the terminal without closing scratch.
Is this possible, if so; how?
elementary OS Stack Exchange is a question and answer site for developers and users of elementary OS and applications. It only takes a minute to sign up.
Sign up to join this communityYou can use:
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
setsid
setsid scratch-text-editor /path/to/file ; exit
disown
scratch-text-editor /path/to/file & disown ; exit
All in one command:
(scratch-text-editor /path/to/file &) ; exit
command
can I add alternative commands in my answer?
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.
D
is for Detach? Or do you mean why not just close it? That will close the application too
Simply detach the process from terminal's process to its parent by:
command-to-run & disown
This should work with any app opened from the terminal.
Type:
scratch-text-editor
After Scratch opens, type:
Ctrl + z
This will halt the process, but not close Scratch.
Next, type:
bg
This will move Scratch's process to the background.
Now, finally type:
disown
That's it.