{"id":5614,"date":"2012-05-25T11:41:48","date_gmt":"2012-05-25T06:11:48","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=5614"},"modified":"2017-05-10T16:53:47","modified_gmt":"2017-05-10T11:23:47","slug":"bash-script-to-open-a-terminal-with-multiple-tabs-on-linux-start-up","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/bash-script-to-open-a-terminal-with-multiple-tabs-on-linux-start-up\/","title":{"rendered":"Bash script to open a terminal with multiple tabs on Linux start-up"},"content":{"rendered":"<p>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 :<\/p>\n<p><strong>1. Write a script<\/strong>:-<\/p>\n<p>[bash]<br \/>\nsleep 1m;gnome-terminal &#8211;geometry=150&#215;50 &#8211;tab &#8211;title=&quot;echo&quot; -e &quot;bash -c \\&quot;echo &quot;hello&quot;;echo &quot;there&quot;;exec bash\\&quot;&quot; &#8211;tab &#8211;title=&quot;idea&quot; -e &quot;bash -c \\&quot;\/opt\/idea-IU-111.69\/bin\/idea.sh;exec bash\\&quot;&quot; &#8211;tab &#8211;title=&quot;sql&quot; -e &quot;bash -c \\&quot;mysql -uroot -pigdefault;\\&quot;&quot; &#8211;tab &#8211;title=&quot;firefox&quot; -e &quot;bash -c \\&quot;\/usr\/bin\/firefox www.gmail.com;\\&quot;&quot;<br \/>\n[\/bash]<\/p>\n<p>The script above will open a terminal with 4 tabs :<\/p>\n<ol>\n<li>echo &#8220;hello there&#8221;<\/li>\n<li>Idea<\/li>\n<li>MySql<\/li>\n<li>Firefox<\/li>\n<\/ol>\n<p>The script will also set the titles in the terminal for each tab.<\/p>\n<p>One can personalize the above script accordingly.<\/p>\n<p>Description of the script :-<\/p>\n<p>sleep 1m\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0 : Executes the script after 1 minute so that system finishes its startup process.<br \/>\ngnome-terminal\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 : Open a terminal.<br \/>\n&#8211;geometry=150&#215;50 \u00a0\u00a0\u00a0\u00a0\u00a0 : Set screen size for terminal.<br \/>\n&#8211;tab\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0 : Open new tab<br \/>\n&#8211;title\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 : Set title for the terminal<br \/>\n-e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Execute the argument inside the terminal.<br \/>\nexec bash\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Starts a new bash after executing all the commands. This command is required if you do not want to close the current tab .<\/p>\n<p><strong>2<\/strong>. <strong>Save the script anywhere in the file system and make the file executable using the following command:<\/strong><\/p>\n<p>[bash]<br \/>\n$chmod +x file.sh<br \/>\n[\/bash]<\/p>\n<p><strong>3. Add this file to startup applications<\/strong> :-<\/p>\n<p>Go to\u00a0 System &gt; Preferences &gt; Startup Applications<\/p>\n<p>Click on add\u00a0 and in command write-<\/p>\n<p>[bash]<br \/>\nbash path\/to\/your\/file.sh<br \/>\n[\/bash]<\/p>\n<p>Close and its done!<\/p>\n<p>Next time when you start your system, all the tasks mentioned in the script will be automated.<\/p>\n<p>Hope this helped!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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:- [bash] sleep 1m;gnome-terminal &#8211;geometry=150&#215;50 &#8211;tab &#8211;title=&quot;echo&quot; -e &quot;bash -c \\&quot;echo &quot;hello&quot;;echo &quot;there&quot;;exec bash\\&quot;&quot; &#8211;tab &#8211;title=&quot;idea&quot; -e &quot;bash -c \\&quot;\/opt\/idea-IU-111.69\/bin\/idea.sh;exec bash\\&quot;&quot; &#8211;tab &#8211;title=&quot;sql&quot; -e &quot;bash [&hellip;]<\/p>\n","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":37},"categories":[1],"tags":[475,823,260,474,453,821,822],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/5614"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=5614"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/5614\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=5614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=5614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=5614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}