home / blog / podcasts / notes / photos / about / more

subl on Linux

opening from terminal

Posted by Jeena

I moved on from OS X to Linux and Ubuntu is now my distribution of choise. I installed Sublime Text 2 on it and everything is great except one little detail the subl command for the command line.

On OS X it works really well, you can open Sublime Text with a specific file or directory from the terminal just by:

subl path/to/dir/

It then opens Sublime text with this directory and you can go on working in the terminal, yes you can even close the terminal without Sublime Text, as a child process being killed.

On Linux on the other hand subl is just a softlink to the sublime-text-2 binary, which means that if you want to keep working in that terminal you need to append a ampersand "&" and you can't close the terminal window because then Sublime Text gets killed too.

So I had to do something about and I removed the /usr/bin/subl softlink and replaced it with this script:

#!/bin/sh
nohup sublime-text-2 $1 >/dev/null 2>&1 &

Which not only does that I don't have to append the ampersand and the nohup detaches the Sublime Text process from the terminal but the 2>/dev/null gets even rid of all the warnings and errors produced by Sublime Text when running and poluting my terminal.

1 Mention

Have you written a response? Let me know the URL:

There's also indie comments (webmentions) support.