Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question
    
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 –  emab Sep 3 '13 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 Sep 3 '13 at 13:06
    
you may pipe the output of each command into a file and use tail -f logname to see the log. –  emab Sep 3 '13 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

or

tail -numberoflines myfirstlog
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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