I'm developping some rails apps on Mac 10.8.5, and often times, I have a terminal window with a few tabs running commands: rails s rails c mongod bundle exec guard start

each of which in its own tab. when I switch project, I have to close them all and when I return to this project, I have to rerun these commands all over again. Is there a shortcut or another terminal tool that I can use to run them all in a prepackaged way?

Thank you!

  • In linux when you use & it sends the program to background and you can bring it to foreground using fg. I think the same applies in mac. Just run commandtoberun & and fg pid to bring it to foreground
    – orezvani
    Sep 3, 2013 at 12:43
  • Hi Emab, that did work for running them all at once, but I also need them separate terminal tabs for reading the logs each of them generates. Any ideas?
    – Nik So
    Sep 3, 2013 at 13:06
  • you may pipe the output of each command into a file and use tail -f logname to see the log.
    – orezvani
    Sep 3, 2013 at 13:13

1 Answer 1


To run the commands in the bachground you can use the & operator. For example you can use

myfirstcommand &

and it gives you the pid of the process.

If you want to have the log of each command, you can pipe the output of each command, and use the tail command to watch the log whenever you want to:

myfirstcommand  & >> myfirstlog
mysecondcommand & >> mysecondlog

and whenever you want to watch the log of each one you can use the tail like following:

tail -f myfirstlog


tail -numberoflines myfirstlog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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