{"id":2311,"date":"2022-06-14T09:56:25","date_gmt":"2022-06-14T16:56:25","guid":{"rendered":"https:\/\/in.nau.edu\/hpc\/?page_id=2311"},"modified":"2024-08-13T14:49:40","modified_gmt":"2024-08-13T21:49:40","slug":"using-the-screen-command","status":"publish","type":"page","link":"https:\/\/in.nau.edu\/arc\/using-the-screen-command\/","title":{"rendered":"Working With an Unstable Internet Connection"},"content":{"rendered":"<h1>Working With an Unstable Internet Connection<\/h1>\n<p>If you are working with an unstable internet connection via ssh and you don&#8217;t want to lose your progress every time you disconnect, the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen<\/span> command allows you to run a background session that you can reconnect to later.<\/p>\n<h3>Starting a screen session<\/h3>\n<p>Screen enables your login process and connected processes to remain running if\/while your ssh connection is interrupted. Its pretty easy:<\/p>\n<ol>\n<li>Start a command-line shell on one of Monsoon&#8217;s login nodes<\/li>\n<li>Start a screen session by running the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen<\/span> command<\/li>\n<li>Initiate any programs\/processes<\/li>\n<\/ol>\n<p>If desired, you now may disconnect from Monsoon while allowing your programs to continue without being actively connected. Here&#8217;s how:<\/p>\n<ol type=\"a\">\n<li>Simply close your SSH client\/window<br \/>\nOR:<\/li>\n<li>Exit your active <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen<\/span> gracefully with this key-sequence:<br \/>\n<kbd>ctrl<\/kbd>+<kbd>a<\/kbd>; <i>then release both keys<\/i>; <em>then hit<\/em> <kbd>d<\/kbd> (The <kbd>ctrl<\/kbd>+<kbd>a<\/kbd>, <kbd>d<\/kbd> sequence detaches from the session. The <kbd>ctrl<\/kbd>+<kbd>a<\/kbd> keystroke itself tells <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen<\/span> to listen for subsequent key-commands.)<\/li>\n<\/ol>\n<p>Now that you are disconnected from screen, your processes will continue to run to completion.<\/p>\n<h3>Reconnecting to a &#8216;screen&#8217; session<\/h3>\n<p>To reconnect to screen to monitor or end your programs do the following.<\/p>\n<ol>\n<li>Ensure you are logged in to the same system<br \/>\n(e.g.: wind, rain, dtn1, ondemand)<\/li>\n<li>Run <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen -r<\/span><\/li>\n<\/ol>\n<p>The <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen -r<\/span> command will resume an existing screen session. If there are multiple sessions you will have to be specific:<\/p>\n<ol type=\"a\">\n<li>Run <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen -ls<\/span> to list the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen<\/span> sessions.\n<pre><code>[abc123@wind ~ ]$ screen -ls\r\nThere are screens on:\r\n1144795.pts-0.wind (Detached)\r\n1944762.pts-0.wind (Detached)\r\n2463388.pts-7.wind (Detached)\r\n3 Sockets in \/run\/screen\/S-abc123.<\/code><\/pre>\n<p>&nbsp;<\/li>\n<li>Then run <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\">screen -r &lt;<i>number<\/i>&gt;<\/span> to resume.\n<pre><code>[abc123@wind ~ ]$ screen -r 1144795<\/code><\/pre>\n<p>&nbsp;<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Working With an Unstable Internet Connection If you are working with an unstable internet connection via ssh and you don&#8217;t want to lose your progress every time you disconnect, the screen command allows you to run a background session that you can reconnect to later. Starting a screen session Screen enables your login process and [&hellip;]<\/p>\n","protected":false},"author":470,"featured_media":0,"parent":0,"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":"","ring_central_script_selection":"","footnotes":""},"class_list":["post-2311","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages\/2311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/users\/470"}],"replies":[{"embeddable":true,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/comments?post=2311"}],"version-history":[{"count":46,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages\/2311\/revisions"}],"predecessor-version":[{"id":3576,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages\/2311\/revisions\/3576"}],"wp:attachment":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/media?parent=2311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}