Ok every day I go through the same routine, and its tediously annoying. So I came up with a thought and wondered if its remotely possible. What I want to do is open maybe 3-5 terminal windows, and in each one when opened preform a specific command or run a specific shell script. With that my question would be, is it at all possible, and how would I do it? or where would I look to try to figure out what I want to do?

Basically I want to create some type of shortcut in a matter of speaking, that all I have to do is click something I put on the desktop of ubuntu, and have it open the x terminals and do what I need to do initially to get all the stuff I need started up started rather than having to do everything manually. Something that will shave about 30 minutes off my work day every day.. I'm not familiar enough with a Linux enviroment to figure something out like this. I just have to have everything I need launched, launch prior to doing my regular work.

  • What desktop environment are you using? Gnome, Unity, KDE, LXDE, XFCE? – Arcege Jan 4 '12 at 23:24

It's not that hard. First you need to know what you want to start, let's say five gnome-terminal instances, and then set it up in your windowing system to have an icon to click on to start the program.

$ mkdir -p ~/bin  # create a directory to store your programs
$ cat <<'EOF' > ~/bin/terminalstartup.sh
# start five terminal sessions in the background and exit
gnome-terminal -t "Terminal 1" -e top &    # terminal running process monitor
gnome-terminal -t "Terminal 2" -e irssi &  # terminal running IRC client
gnome-terminal -t "Terminal 3" &           # terminal running just a shell
gnome-terminal -t "Terminal 4" -e mutt &   # terminal running email client
gnome-terminal -t "Terminal 5" &           # terminal running another shell
exit 0
$ chmod a+x ~/bin/terminalstartup.sh  # make it executable

Then we need to create something for the desktop environment to use:

$ mkdir -p ~/Desktop # should already exist
$ cat <<'EOF' > ~/Desktop/TermStart.desktop

[Desktop Entry]
Comment=Start my terminals

If things go "right", then you might see a new Icon on your desktop background (depends on which desktop environment settings are set). If you double click on it, it should start your terminals. Don't forget to replace "USERNAME" with your own login user name.

This is a very simple example, but you didn't say anything more than "have five terminal start with some commands". This is all done with a) shell scripting (read the manpage for bash or dash), and b) Desktop Entry files (can read more at http://www.ubuntuvibes.com/2011/12/easily-edit-and-create-custom-launchers.html).

  • First, thanks I was trying to do something simlar yesterday after a few hours of trial and error via methods found in searches. This looks like its a good starting point for me. Currently I have a need for 3 terminals. Of which I need opened and running the command as shown above. But I need them to also stay open. Example one of them is starting a rails server in a mode to output to the terminal window so I can see whats happening to make sure all the BG processes are running while the web side is. Is there a way to prevent the termials from closing? – chris Jan 5 '12 at 20:00
  • There are ways of having the program restart if it terminates, or just have it wait for user input. But I'm not sure if that is what you want. Also, have you looked into screen? It can open as many shells/programs as you like, but uses one terminal window so you save window real estate. I start screen with a couple of shells, top, an interactive python. Then use hotkeys to switch between and/or among multiple regions. – Arcege Jan 5 '12 at 21:03

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.