OS X's Sublime Text has this subl
command, where running it from the terminal will summon Sublime Text, in the background. This means that closing the terminal window will not close Sublime Text.
In Linux, we can do that with the help of nohup
. Assuming you have installed a sublime_text
command that opens a new process associated with Sublime Text, then you can do
$ nohup sublime_text &
When you close your terminal window, Sublime Text will still remain open.
Now let's add the subl
command to Linux, shall we? Create a "subl" file in /usr/bin
, and in it, write out:
#!/bin/bash
nohup sublime_text $@ >/dev/null 2>&1 &
(The >/dev/null 2>&1
right before the final &
instructs Bash to throw all console output (be it the regular output, or error output) to /dev/null
, which, the OS simply ignores)
And then, make /usr/bin/subl
executable:
$ chmod +x /usr/bin/subl
Then, run subl
, and you should see Sublime Text show up. Close your terminal window, and watch Sublime Text remain open.
Just for the information of people reading this now: Linux's Sublime Text has had the
subl
command as well for some time now. Maybe depending on the installation mode, I don't know.It's interesting to compare this built-in
subl
with the solution proposed here. The/usr/bin/subl
file contains the following: