{"id":208,"date":"2024-07-30T14:47:14","date_gmt":"2024-07-30T13:47:14","guid":{"rendered":"https:\/\/vgdata.dk\/blog\/?p=208"},"modified":"2024-07-30T14:47:14","modified_gmt":"2024-07-30T13:47:14","slug":"start-tmux-automatically-when-connecting-via-ssh","status":"publish","type":"post","link":"http:\/\/vgdata.dk\/blog\/?p=208","title":{"rendered":"Start tmux automatically when connecting via SSH"},"content":{"rendered":"\n<p>tmux is a beautiful terminal application, which is able to survive disconnections.<br>But I ofte forget to start it, when I connect to a server via SSH.<br>I found this solution on the internet, unfortunately I cannot remember where, so I cannot give kredit to the originator.<br>However: put this at the end of your bashrc, ant it will start a tmux session, if one doesn&#8217;t exists, and connect to a session that already exists.<\/p>\n\n\n\n<p>if [[ -n &#8220;${SSH_TTY}&#8221; ]] &amp;&amp; [[ &#8220;${TERM}&#8221; != &#8220;tmux-256color&#8221; ]]; then tmux attach || tmux &amp;&amp; exit<br>fi<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>tmux is a beautiful terminal application, which is able to survive disconnections.But I ofte forget to start it, when I connect to a server via SSH.I found this solution on the internet, unfortunately I cannot remember where, so I cannot &hellip; <a href=\"http:\/\/vgdata.dk\/blog\/?p=208\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-208","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/208"}],"collection":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208"}],"version-history":[{"count":1,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions"}],"predecessor-version":[{"id":209,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions\/209"}],"wp:attachment":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}