{"id":19,"date":"2014-01-01T13:53:00","date_gmt":"2014-01-01T13:53:00","guid":{"rendered":""},"modified":"2016-02-25T18:09:02","modified_gmt":"2016-02-25T18:09:02","slug":"how-to-run-tmux-via-ssh-instantly","status":"publish","type":"post","link":"https:\/\/www.root42.de\/blog\/?p=19","title":{"rendered":"How to run tmux via ssh instantly"},"content":{"rendered":"<p>With my Raspberry Pi, what I do very, very often is this:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\"><span style=\"color: #666666;\">localhost$<\/span> <b>ssh raspberrypi.local<\/b> &nbsp; &nbsp;<span style=\"color: purple;\"># Here I already type the next command and wait a while<\/span><\/span><br \/><span style=\"font-family: Courier New, Courier, monospace;\"><span style=\"color: #666666;\">raspberrypi$<\/span> <b>tmux attach<\/b><\/span><\/p>\n<p>This is all well and good, but sometimes the Pi is down, and I will attach to one of my local tmux sessions. Very annoying. Instead you could try to do this:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\"><span style=\"color: #666666;\">localhost$<\/span> <b>ssh raspberrypi.local tmux attach<\/b><\/span><br \/><b><span style=\"font-family: Courier New, Courier, monospace;\">not a terminal<\/span><\/b><\/p>\n<p>Well, that did no good. So a look at the man-page of ssh or a <a href=\"http:\/\/unix.stackexchange.com\/questions\/37643\/how-to-run-mutt-via-ssh-without-going-through-an-interactive-shell\">quick search<\/a> reveals this gem:<\/p>\n<p><span style=\"font-family: Courier New, Courier, monospace;\"><span style=\"color: #666666;\">localhost$<\/span> <b>ssh raspberrypi.local -t tmux attach<\/b><\/span><\/p>\n<div><\/div>\n<p>This allocates a pseudo terminal, which is needed by tmux to function correctly. This is also done by ssh, if no command is given, but a login shell is spawned.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With my Raspberry Pi, what I do very, very often is this: localhost$ ssh raspberrypi.local &nbsp; &nbsp;# Here I already type the next command and wait a whileraspberrypi$ tmux attach This is all well and good, but sometimes the Pi is down, and I will attach to one of my local tmux sessions. Very annoying. &hellip; <a href=\"https:\/\/www.root42.de\/blog\/?p=19\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to run tmux via ssh instantly&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,3,20,17,10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19"}],"collection":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":1,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":203,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/203"}],"wp:attachment":[{"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.root42.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}