Quick Bash Tip: Less mouse when finding commands

When I run rake --tasks looking for a particular command, I hate the process of picking up the mouse to copy and paste. I am very weak with my bash-fu and so I decided to ask someone. Thanks to one of my friends and co-workers, Sandro Turriate, I do not have to pick up the mouse anymore.

I use grep to single out the specific tasks I want, such as rake --tasks | grep db would only find commands containing the letters ‘db’.

Run rake --tasks | grep faker (where faker is what you are looking for), until you find ONLY the task you want to run.

Then run
rake --tasks | grep faker | sh and it runs the output. And of course # gets ignored.

1 Response to “Quick Bash Tip: Less mouse when finding commands”


  1. 1 Jeff Rafter

    Doesn’t “rake -T db” == “rake –tasks | grep db”? There are probably situations where you will want to pipe to grep still, but you could save some keystrokes. The | sh trick is nice though. Thanks Zach!

Comments are currently closed.