It just takes 15 seconds. Send your
details and we’ll get back to you soon.

Bash script to open a terminal with multiple tabs on Linux start-up

All of the tasks performed by us after system startup such as opening a browser, MySql etc can be automated by following the steps mentioned below :

1. Write a script:-

sleep 1m;gnome-terminal --geometry=150x50 --tab --title="echo" -e "bash -c \"echo "hello";echo "there";exec bash\"" --tab --title="idea" -e "bash -c \"/opt/idea-IU-111.69/bin/;exec bash\"" --tab --title="sql" -e "bash -c \"mysql -uroot -pigdefault;\"" --tab --title="firefox" -e "bash -c \"/usr/bin/firefox;\""

The script above will open a terminal with 4 tabs :

  1. echo “hello there”
  2. Idea
  3. MySql
  4. Firefox

The script will also set the titles in the terminal for each tab.

One can personalize the above script accordingly.

Description of the script :-

sleep 1m                       : Executes the script after 1 minute so that system finishes its startup process.
gnome-terminal             : Open a terminal.
–geometry=150×50       : Set screen size for terminal.
–tab                               : Open new tab
–title                              : Set title for the terminal
-e                                   : Execute the argument inside the terminal.
exec bash                      : Starts a new bash after executing all the commands. This command is required if you do not want to close the current tab .

2. Save the script anywhere in the file system and make the file executable using the following command:

$chmod +x

3. Add this file to startup applications :-

Go to  System > Preferences > Startup Applications

Click on add  and in command write-

bash path/to/your/

Close and its done!

Next time when you start your system, all the tasks mentioned in the script will be automated.

Hope this helped!

Nitesh Goel
[Intelligrape Software Pvt. Ltd.]

Posted in Linux | Tagged , , , , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get our latest updates, Subscribe.

By signing up, you agree to our Terms of Service and Privacy Policy.