Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I love Ubuntu, and I used it for a long time before Unity. I loved it. Now I have a Mac...

I have some habits remaining from my Ubuntu workflow.

Sometimes I like to open folders from terminal directly, on Ubuntu I would do gksudo gnome-open /folder or open files for editing in my favorite editor sudo gedit /file.php

So how is it done on OS X?

I use Sublime Text 2 as my main editor, so is it possible to use Sublime like gedit from terminal?

P.S.: Quick Google search found me open . for opening folders. But will sudo work like gksudo on Ubuntu?

share|improve this question
up vote 3 down vote accepted

will sudo work like gksudo on Ubuntu?

No, it won't. To open the folder you're currently in, all you really need to do is type open .. If you want to open a file, the same applies.

If you however need root permissions for a file, then you need to tell open which application exactly to run. Normally, you would do this with open -a NameOfApplication, like open -a TextEdit, but TextEdit will still be run without root privileges if you call sudo open -a TextEdit. This is because the process of opening is deferred from open to a service in OS X that won't run as root.

The trick is to run the actual executable of the application you want to open with sudo. For example:

sudo /Applications/ /path/to/file

If you're lazy and want to repeat doing that, you could create an alias in your shell.

is it possible to use Sublime like gedit from terminal?

Much easier:

ln -s "/Applications/Sublime Text" ~/bin/subl

That requires ~/bin/subl to be in your PATH. Otherwise:

sudo ln -s "/Applications/Sublime Text" /bin/subl

Then just run subl /path/to/file.

share|improve this answer
Sorry for accepting your answer so late. ty this is very helpful! – Sandro Dzneladze Aug 18 '12 at 22:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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