{"id":2236,"date":"2008-11-05T15:00:07","date_gmt":"2008-11-05T15:00:07","guid":{"rendered":"http:\/\/t.motd.kr\/articles\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window"},"modified":"2022-12-28T01:45:30","modified_gmt":"2022-12-27T16:45:30","slug":"opening-a-new-tab-in-an-existing-gnome-terminal-window","status":"publish","type":"post","link":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/","title":{"rendered":"Opening a new tab in an existing GNOME terminal window"},"content":{"rendered":"\n

Use RoxTerm<\/a> instead \u2013 'roxterm --tab'<\/code> opens a new tab in an existing terminal window, with no hack described here.<\/em><\/p>\n\n\n\n

GNOME<\/span> terminal<\/a> has great support for tabbed terminal sessions. You can simply open a new tab by pressing CTRL<\/span>+SHIFT+T and it\u2019s very convenient.<\/p>\n\n\n\n

However, it seems like there\u2019s no straightforward way to ask gnome-terminal<\/code> command to reuse an existing window and add a new tab there. I tried various options like --tab<\/code>, but they didn\u2019t work as I expected. I just want to keep only one terminal window in my desktop, but it looks like there\u2019s no command line option that does the job.<\/p>\n\n\n\n

So, I wrote a shell script that adds a new tab to an existing GNOME<\/span> terminal window when there is already a running instance. It also launches a new terminal window if necessary:<\/p>\n\n\n\n

#!\/bin\/bash\n# Path: \/usr\/local\/bin\/gnome-terminal\nif [ \"x$*\" != \"x\" ]; then\n  \/usr\/bin\/gnome-terminal \"$@\"\nelse\n  pgrep -u \"$USER\" gnome-terminal | grep -qv \"$\"\n  if [ \"$?\" == \"0\" ]; then\n    WID=`xdotool search --class \"gnome-terminal\" | head -1`\n    xdotool windowfocus $WID\n    xdotool key ctrl+shift+t\n    wmctrl -i -a $WID\n  else\n    \/usr\/bin\/gnome-terminal\n  fi\nfi<\/code><\/pre>\n\n\n\n

This script looks for an existing gnome-terminal window, sends CTRL<\/span>+SHIFT+T key event there, and raises the terminal window. Please note that xdotool<\/a> and wmctrl<\/a> are required to run the script. They should be available in most Linux distributions.<\/p>\n\n\n\n

It\u2019s just a band-aid solution \u2013 I hope I can get rid of this script from my system when the next release of GNOME<\/span> terminal is out.<\/p>\n","protected":false},"excerpt":{"rendered":"

Use RoxTerm instead \u2013 ‘roxterm –tab’ opens a new tab in an existing terminal window, with no hack described here. GNOME terminal has great support for tabbed terminal sessions. You can simply open a new tab by pressing CTRL+SHIFT+T and it\u2019s very convenient. However, it seems like there\u2019s no straightforward way to ask gnome-terminal command… Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"yoast_head":"Opening a new tab in an existing GNOME terminal window — T's message of the day<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Opening a new tab in an existing GNOME terminal window — T's message of the day\" \/>\n<meta property=\"og:description\" content=\"Use RoxTerm instead \u2013 'roxterm --tab' opens a new tab in an existing terminal window, with no hack described here. GNOME terminal has great support for tabbed terminal sessions. You can simply open a new tab by pressing CTRL+SHIFT+T and it\u2019s very convenient. However, it seems like there\u2019s no straightforward way to ask gnome-terminal command... Continue reading →\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/\" \/>\n<meta property=\"og:site_name\" content=\"T's message of the day\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/trustin\" \/>\n<meta property=\"article:published_time\" content=\"2008-11-05T15:00:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-27T16:45:30+00:00\" \/>\n<meta name=\"author\" content=\"Trustin Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/trustin\" \/>\n<meta name=\"twitter:site\" content=\"@trustin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Trustin Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/\"},\"author\":{\"name\":\"Trustin Lee\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"headline\":\"Opening a new tab in an existing GNOME terminal window\",\"datePublished\":\"2008-11-05T15:00:07+00:00\",\"dateModified\":\"2022-12-27T16:45:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/\"},\"wordCount\":215,\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/\",\"name\":\"Opening a new tab in an existing GNOME terminal window — T's message of the day\",\"isPartOf\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\"},\"datePublished\":\"2008-11-05T15:00:07+00:00\",\"dateModified\":\"2022-12-27T16:45:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vault.motd.kr\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Opening a new tab in an existing GNOME terminal window\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#website\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/\",\"name\":\"T's message of the day\",\"description\":\"the best is yet to come\",\"publisher\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d\",\"name\":\"Trustin Lee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"contentUrl\":\"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png\",\"width\":966,\"height\":966,\"caption\":\"Trustin Lee\"},\"logo\":{\"@id\":\"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/t.motd.kr\/\",\"https:\/\/www.facebook.com\/trustin\",\"https:\/\/www.instagram.com\/trustinlee\/\",\"https:\/\/www.linkedin.com\/in\/trustin\",\"https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin\",\"https:\/\/www.youtube.com\/@trustinlee\"]}]}<\/script>","yoast_head_json":{"title":"Opening a new tab in an existing GNOME terminal window — T's message of the day","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/","og_locale":"en_US","og_type":"article","og_title":"Opening a new tab in an existing GNOME terminal window — T's message of the day","og_description":"Use RoxTerm instead \u2013 'roxterm --tab' opens a new tab in an existing terminal window, with no hack described here. GNOME terminal has great support for tabbed terminal sessions. You can simply open a new tab by pressing CTRL+SHIFT+T and it\u2019s very convenient. However, it seems like there\u2019s no straightforward way to ask gnome-terminal command... Continue reading →","og_url":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/","og_site_name":"T's message of the day","article_publisher":"https:\/\/www.facebook.com\/trustin","article_author":"https:\/\/www.facebook.com\/trustin","article_published_time":"2008-11-05T15:00:07+00:00","article_modified_time":"2022-12-27T16:45:30+00:00","author":"Trustin Lee","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/trustin","twitter_site":"@trustin","twitter_misc":{"Written by":"Trustin Lee","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/#article","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/"},"author":{"name":"Trustin Lee","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"headline":"Opening a new tab in an existing GNOME terminal window","datePublished":"2008-11-05T15:00:07+00:00","dateModified":"2022-12-27T16:45:30+00:00","mainEntityOfPage":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/"},"wordCount":215,"publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/","url":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/","name":"Opening a new tab in an existing GNOME terminal window — T's message of the day","isPartOf":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#website"},"datePublished":"2008-11-05T15:00:07+00:00","dateModified":"2022-12-27T16:45:30+00:00","breadcrumb":{"@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vault.motd.kr\/wordpress\/posts\/2236\/opening-a-new-tab-in-an-existing-gnome-terminal-window\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vault.motd.kr\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Opening a new tab in an existing GNOME terminal window"}]},{"@type":"WebSite","@id":"https:\/\/vault.motd.kr\/wordpress\/#website","url":"https:\/\/vault.motd.kr\/wordpress\/","name":"T's message of the day","description":"the best is yet to come","publisher":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vault.motd.kr\/wordpress\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/4430ad90fc2ddeef051565701d85db9d","name":"Trustin Lee","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","contentUrl":"https:\/\/vault.motd.kr\/wordpress\/wp-content\/uploads\/2020\/09\/avatar-2019-966px.png","width":966,"height":966,"caption":"Trustin Lee"},"logo":{"@id":"https:\/\/vault.motd.kr\/wordpress\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/t.motd.kr\/","https:\/\/www.facebook.com\/trustin","https:\/\/www.instagram.com\/trustinlee\/","https:\/\/www.linkedin.com\/in\/trustin","https:\/\/twitter.com\/https:\/\/www.twitter.com\/trustin","https:\/\/www.youtube.com\/@trustinlee"]}]}},"_links":{"self":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2236"}],"collection":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/comments?post=2236"}],"version-history":[{"count":2,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2236\/revisions"}],"predecessor-version":[{"id":5948,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/posts\/2236\/revisions\/5948"}],"wp:attachment":[{"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/media?parent=2236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/categories?post=2236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vault.motd.kr\/wordpress\/wp-json\/wp\/v2\/tags?post=2236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}