For a certain task, everytime I have to open 10 bash terminals and write different commands on them. Any way to automate this ?

I am running Fedora linux.

  • This probably depends heavily on what desktop environment (e.g. Gnome, KDE, awesome, ...) you are using. – Benjamin Bannier Jul 29 '10 at 8:59

Just create a shell script which spawns those terminals and executes your commands upon startup. For example, with gnome-terminal you could do

gnome-terminal -e your_command1 &
gnome-terminal -e your_command2 &
gnome-terminal -e your_command3 &
gnome-terminal -e your_command4 &

(and so on...)

EDIT: Removed unnecessary nohup command since it wasn't needed in this case. My original idea was to include nohup so the spawned gnome-terminal windows would not get killed in case the window where the script was started would be closed. It appears that those launhed terminal windows will stay alive just fine even without nohup.

|improve this answer|||||
  • Just being curious, what is the advantage of using nohup in this example? – nisc Jul 29 '10 at 10:26
  • If you close the terminal window where you started the above script from, the spawned gnome-terminal windows will stay alive. Without nohup they will get killed together with the original terminal window. EDIT: I just tried without nohup, still seems to work. Oh well. I'm sure under some conditions I've managed to kill my original window. Maybe that was just a dream. (Yes, yes, using screen while starting up the script would help, but one can't always remember to start screen so that's why the safety measure...) – Janne Pikkarainen Jul 29 '10 at 10:31
  • niscy: I edited my original answer, thank you for noting me about the unnecessary nohup :) – Janne Pikkarainen Jul 29 '10 at 10:37

There is already an answer which gives a straight forward solution to your problem, but if you one day want to do more advanced GUI automation stuff, I can highly recommend Sikuli.


|improve this answer|||||

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.