Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Open folder in Terminal" for Spotlight or Alfred

Is there any way in Spotlight to have a folder open in a Terminal window, either by providing an "Open in Terminal" option in search results, or (ideally) by holding down a key when selecting a result? Basically the same way holding down command will "Open containing folder" maybe make it so holding option (or whatever key) could "Open in Terminal".

Alternately, is there a way to setup the Alfred app so that it will always open folder search results in the Terminal? that might be even better, then I could use ctrl-space exclusively for opening folders in the Terminal and command-space (Spotlight) for everything else.

The closest thing I can find to anything like these is the "cdto" application, which adds an "Open in Terminal" button to the Finder. This is nice, but being able to do this directly from Spotlight or with a keypress would be much more convenient.

like image 613
neurodynamic Avatar asked Jul 26 '11 16:07

neurodynamic


2 Answers

I've found this to be the fastest method without any external tinkering.

Requirement: need to have iTerm or Terminal in the Dock:

  1. Type the folder name into Alfred / Spotlight
  2. Click and drag the folder that was found into the iTerm / Terminal icon in the Dock
like image 20
snowbound Avatar answered Oct 12 '22 23:10

snowbound


This question is old and you undoubtedly found the answer by now; for the sake of completeness: the latest version of Alfred allows one to search/navigate the filesystem from within Alfred, and take action on the folder or file found. One folder action is "Open Terminal Here", which seems to be what you are asking for.

like image 102
verboze Avatar answered Oct 13 '22 00:10

verboze