15

I run commands in terminal a lot and i'm wondering if it is possible to run the commands from spotlight. For example in spotlight would like to run the command(because i have a lot of network issues):

ping google.com

And then spotlight to load terminal and execute the command instead of having to load terminal because it takes so long to load. So is this possible?

  • 1
    Just have Terminal open in the background at login if you don't like the load time. – Nathan Greenstein Apr 18 '11 at 14:38
  • @Nathan I can't afford it RAM is limited on my machine as I only have 2GB on the machine that needs it most of the time. Im really just trying to make myself lazy. As i've already added a link from Safari to sad for typing mistakes. – Dean Apr 18 '11 at 14:43
  • 2GB should be enough for Terminal so if it is slow to start there could be other reasons - e.g. things in your shell start up scripts e.g. .profile – user151019 Apr 18 '11 at 14:56
  • No OSX has serious memory issues. Especially when you don't clean up your system regularly, I would if I had time to do this but my main machine is in use 24/7. – Dean Apr 18 '11 at 15:36
  • 1
    Terminal uses a minuscule amount of RAM. If it's doing otherwise there's something wrong with your system. Right now it's using less than: a) a single Google Chrome tab, b) Skype, c) Adium, d) Finder. You may want to look at Visor to see if it suits your needs. – boehj May 6 '11 at 14:40
7

Just a heads up that Alfred app now has both global hotkeys which allows you to launch apps/commands/applescripts with a key combo, as well as Terminal/Shell integration, which lets you run any Terminal command without launching Terminal.

For example, create a script to auto-shorten a URL using goo.gl then copying it to clipboard (here's how you can do that). Or launch any terminal command (e.g. ping yahoo.com) to pop up a Terminal window.

It's part of the Powerpack and is in pre-release right now, going to general availability next week :)

Vero (community gal for @alfredapp)

  • 4
    this is a paid only feature.. -1 b/c you gave an answer that requires $$ for a question asking for a solution that doesn't – abbood Apr 27 '16 at 11:25
3

Not directly but write the commands you want in a shell script and save the script with a .command extension and chmod it so it is executable. This is clickable from Finder and so should work from spotlight

2

It's not possible through Spotlight itself.

But it's possible through free applications that can also search files and launch programs, like Spotlight.

You have the almighty Quicksilver, that can also make coffee and walk the dog.

And the new player Alfred, which is quite impressive as well.

1

I use both DTerm and Alfred. DTerm is very nice for the occasional quick command or even a man page as its results window expands to fill the screen and scroll if necessary. A simple ESC dismisses the results.

http://decimus.net/DTerm/

1

This is possible with Flashlight (http://flashlight.nateparrott.com/). Flashlight is an unofficial api to spotlight and offers a plugin (http://flashlight.nateparrott.com/plugin/terminal) to run terminal commands right inside spotlight.

  • Flashlight is no longer supported for MacOS Sierra and higher. – Jersh Dec 12 '17 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .