{"id":166,"date":"2017-04-18T09:44:29","date_gmt":"2017-04-18T13:44:29","guid":{"rendered":"https:\/\/carleton.ca\/rcs\/?page_id=166"},"modified":"2021-07-29T10:23:32","modified_gmt":"2021-07-29T14:23:32","slug":"background-terminal-sessions","status":"publish","type":"page","link":"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/","title":{"rendered":"Background Terminal Sessions"},"content":{"rendered":"<p>It is possible to run\u00a0Linux commands in the background. \u00a0You are able to disconnect from the Virtual Machine (VM) and connect later, and commands continue to run in the background. \u00a0This is useful\u00a0if you\u00a0need to run code that takes a long time.<\/p>\n<p>The<em> tmux<\/em> command on the Linux command-line\u00a0allows you to do exactly this. Using <em>tmux<\/em>\u00a0you can run commands\u00a0on the VM, logout, and reconnect to your running programs later.<\/p>\n<p>You can tell that you are running <em>tmux<\/em> by the green bar along the bottom of your Linux command-line window.<\/p>\n<h3>Creating a new session<\/h3>\n<p>This command will start a new <em>tmux<\/em> session.\u00a0 You will see a new Linux command line that is running inside tmux.\u00a0 Each <em>tmux<\/em> session has a name, so you can have different sessions, and reference them by their unique names.<\/p>\n<blockquote><p>tmux new -s example01<\/p><\/blockquote>\n<h3>Leaving (detaching) a session<\/h3>\n<p>This leaves a session, but it will keep running so you can resume the session later. When you are in your <em>tmux<\/em> session, type:<\/p>\n<blockquote><p><em>Ctrl-b<\/em> followed by <em>d<\/em><\/p><\/blockquote>\n<h3>Listing sessions<\/h3>\n<p>You can have more than one <em>tmux<\/em> session.\u00a0 To see the list of running sessions, use this command:<\/p>\n<blockquote><p>tmux\u00a0ls<\/p><\/blockquote>\n<h3>Resuming (attaching) a session<\/h3>\n<p>When you want to reconnect to a session that you have already started, use this command:<\/p>\n<blockquote><p>tmux attach -t example01<\/p><\/blockquote>\n<h3>Stopping (killing) a session<\/h3>\n<p>Once you are finished with a <em>tmux<\/em> session, you can get rid of it using this:<\/p>\n<blockquote><p>tmux kill-session -t example01<\/p><\/blockquote>\n<p>OR, type the Linux command <em>exit<\/em> inside your tmux session<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to run\u00a0Linux commands in the background. \u00a0You are able to disconnect from the Virtual Machine (VM) and connect later, and commands continue to run in the background. \u00a0This is useful\u00a0if you\u00a0need to run code that takes a long time. The tmux command on the Linux command-line\u00a0allows you to do exactly this. Using [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"parent":96,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_mi_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Background Terminal Sessions - Research Computing Services<\/title>\n<meta name=\"description\" content=\"It is possible to run\u00a0Linux commands in the background. \u00a0You are able to disconnect from the Virtual Machine (VM) and connect later, and commands continue\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/\",\"url\":\"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/\",\"name\":\"Background Terminal Sessions - Research Computing Services\",\"isPartOf\":{\"@id\":\"https:\/\/carleton.ca\/rcs\/#website\"},\"datePublished\":\"2017-04-18T13:44:29+00:00\",\"dateModified\":\"2021-07-29T14:23:32+00:00\",\"description\":\"It is possible to run\u00a0Linux commands in the background. \u00a0You are able to disconnect from the Virtual Machine (VM) and connect later, and commands continue\",\"breadcrumb\":{\"@id\":\"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/carleton.ca\/rcs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Research Computing and Development Cloud (RCDC)\",\"item\":\"https:\/\/carleton.ca\/rcs\/rcdc\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Background Terminal Sessions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/carleton.ca\/rcs\/#website\",\"url\":\"https:\/\/carleton.ca\/rcs\/\",\"name\":\"Research Computing Services\",\"description\":\"Carleton University\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/carleton.ca\/rcs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Background Terminal Sessions - Research Computing Services","description":"It is possible to run\u00a0Linux commands in the background. \u00a0You are able to disconnect from the Virtual Machine (VM) and connect later, and commands continue","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:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/","url":"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/","name":"Background Terminal Sessions - Research Computing Services","isPartOf":{"@id":"https:\/\/carleton.ca\/rcs\/#website"},"datePublished":"2017-04-18T13:44:29+00:00","dateModified":"2021-07-29T14:23:32+00:00","description":"It is possible to run\u00a0Linux commands in the background. \u00a0You are able to disconnect from the Virtual Machine (VM) and connect later, and commands continue","breadcrumb":{"@id":"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/carleton.ca\/rcs\/rcdc\/background-terminal-sessions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/carleton.ca\/rcs\/"},{"@type":"ListItem","position":2,"name":"Research Computing and Development Cloud (RCDC)","item":"https:\/\/carleton.ca\/rcs\/rcdc\/"},{"@type":"ListItem","position":3,"name":"Background Terminal Sessions"}]},{"@type":"WebSite","@id":"https:\/\/carleton.ca\/rcs\/#website","url":"https:\/\/carleton.ca\/rcs\/","name":"Research Computing Services","description":"Carleton University","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/carleton.ca\/rcs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"}]}},"acf":{"banner_image_type":"none","banner_button":"no"},"_links":{"self":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/166"}],"collection":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":4,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/166\/revisions"}],"predecessor-version":[{"id":303,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/166\/revisions\/303"}],"up":[{"embeddable":true,"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/pages\/96"}],"wp:attachment":[{"href":"https:\/\/carleton.ca\/rcs\/wp-json\/wp\/v2\/media?parent=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}