4

When I'm developing software I normally have one terminal with various tabs open running different things, as an example one of them is running foo

whilst the other running boo

This is fine until I power down my PC and the layout is lost. This leads me to have a daily fumble around as I try to get to get everything setup. Is there a way to automate this?

  • I would recommend you install terminator. Check this askubuntu.com/questions/158159/… – Katu Dec 21 '16 at 10:13
  • @JacobVlijm Thats about terminal size not about the tabs it has open. – Dr Goat Dec 21 '16 at 10:16
  • Ah, you mean specifically tabs, my bad. – Jacob Vlijm Dec 21 '16 at 10:24
  • I'm not totall sure, what you are up to, but it sounds as if devilspie could be helpful.. – Julian Berger Dec 21 '16 at 17:57
  • Hi, @DrGoat , posted an answer, please see. Let me know if you have any additional questions or edits that you'd like me to make. – Sergiy Kolodyazhnyy Dec 21 '16 at 18:34
3

Yes, there is a way to automate it via -t and -e flags to gnome-terminal.

For instance, here's a script I've used quite recently for this question:

#!/bin/bash
gnome-terminal --tab -e "bash -c 'printf \"\033]0;TEST1\007\"; sleep 7'" \
               --tab -e "bash -c 'printf \"\033]0;TEST2\007\"; ping -c 4 8.8.8.8'"

What happens there is that there will be launched gnome-terminal window with two tabs , and each will run its own command. The rest is simple - open Startup Applications and add that script as one of the commands to be launched upon logging-in. Remember to make the script executable and give full path to script as a command.

| improve this answer | |
  • The tabs automatically close after the command is done :/ – Dr Goat Dec 21 '16 at 20:32
  • @DrGoat you want to keep the tabs open ? In that case make it `-e "bash -c 'foo; bash'" That way once command is done, it will drop to new instance of shell. Unlike other terminals, gnome-terminal doesn't have "hold window" option, so you have to use a bit of trickery to keep it open – Sergiy Kolodyazhnyy Dec 21 '16 at 20:59
  • @serg gnome-terminal has a "hold window" option. Go to Edit -> Profile Preferences -> Title and Command -> When command exits -> set to "Hold the terminal open". – wjandrea Dec 22 '16 at 5:09
  • @wjandrea That causes often unintended side effects though, e.g. you can no longer close a terminal window by exiting the shell with exit or CTRL+D. – Byte Commander Dec 22 '16 at 8:56

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.