Get Terminal To Tell You When It’s Done [OS X Tips]

Get Terminal To Tell You When It’s Done [OS X Tips]

Terminal has tons of great applications on the Mac. By accessing the Unix underpinnings of Mac OS X, Terminal allows power users and newbies alike to do things with their Mac that may not be enabled out of the box.

Code monkeys and script jockeys frequently use Terminal to run longer processes than typical, like compiling code (the process of making all those little lines of code into an app that will run on your Mac) or running scripts. When they finish, they finish. There’s no built in way to know that they’re done.

Luckily, there’s a neat little command that can be added to any other Terminal command that will have it speak out loud to you. While it makes little sense for a quick command, it could be pretty helpful when issuing commands that lead to longer processes.

To make this happen, simply add the command below to any other command task in terminal, at the end of the line.

&& say "text to say here"

For example, using our history Terminal command from a couple of weeks ago, you’d want to use something like this:

history | grep "defaults write" >> ~/Documents/defaultsLog.txt && say "all done, dude"

When the text document is created, Terminal says, “all done, dude,” notifying me that I can hop back into terminal and do anything else I need to do there. If the voice you have chosen in System Preferences isn’t to your liking, you can also use a flag on the Terminal command to change voices on the fly (you’ll have to have the voice on your system, though, to make it work). To have Kathy voice your alert, simply add the following -v flag to your command, like so:

&& say -v Kathy "all done, dude"

Fun to play with, for sure, and potentially helpful for anyone needing an audible notification that a specific task is finished in Terminal.

Related
  • _ds82

    Acutally, it’s better to use something like this:

    /scripts/exec_really_long_task_that_could_fail; say “done”

    Why? Because if two tasks are chained using “&&”, the second gets only executed, if the first was successful. If the former task fails and returns another return code than zero, the second command will not be executed!
  • lambaline

    thanks!

About the author

Rob LeFebvreAnchorage, Alaska-based freelance writer and editor Rob LeFebvre is Cult of Mac's Games and Tips Editor. He has contributed to various tech, gaming and iOS sites, including 148Apps, VentureBeat, and Paste Magazine. Feel free to find Rob on Twitter @roblef

(sorry, you need Javascript to see this e-mail address)| Read more posts by .

Posted in OS X, Tips & Tricks | Tagged: , , , , , |