{"id":3338,"date":"2020-05-04T18:23:29","date_gmt":"2020-05-04T23:23:29","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=3338"},"modified":"2020-05-04T18:24:31","modified_gmt":"2020-05-04T23:24:31","slug":"linux-screen-create-connect-disconnect-terminate-sessions","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/linux-screen-create-connect-disconnect-terminate-sessions\/","title":{"rendered":"Linux Screen &#8211; Create, Connect, Disconnect, Terminate Sessions"},"content":{"rendered":"\n<p>Screen is a handy tool that can help you run scripts on servers remotely without having to worry about the session getting terminated.  It seems to operate kinda like a virtual console.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create Screen Session<\/h2>\n\n\n\n<p>Create a new session with a specified name<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">screen -S SessionName<\/pre>\n\n\n\n<p>Example output below.  Create session named testsession and print screen sessions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[bob@localhost imapsync]$ screen -S testsession\n[bob@localhost imapsync]$ screen -ls\nThere are screens on:\n3313.testsession (Attached)\n1 Sockets in \/var\/run\/screen\/S-bob.\n[bob@localhost imapsync]$<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Disconnect from Screen Session<\/h2>\n\n\n\n<p>You can disconnect from a screen session by hitting ctrl + a and then ctrl +d<\/p>\n\n\n\n<p>&#8220;ctrl + a&#8221; then &#8220;ctrl + d&#8221;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">List Screen Sessions<\/h2>\n\n\n\n<p>You can list the screen sessions with<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">screen -ls<\/pre>\n\n\n\n<p>Example<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[bob@localhost imapsync]$ screen -ls\nThere are screens on:\n3212.testsession (Detached)\n2556.xap (Detached)\n\n2 Sockets in \/var\/run\/screen\/S-bob.\n[bob@localhost imapsync]$<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Connect to screen Session<\/h2>\n\n\n\n<p>You can reconnect to a screen session with<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">screen -r testsession <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Terminate Screen Session<\/h2>\n\n\n\n<p>To terminate a screen session, connect to that session and then on a clear line hit ctrl + d<\/p>\n\n\n\n<p>Same way as if you were closing a remote ssh connection.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Screen is a handy tool that can help you run scripts on servers remotely without having to worry about the session getting terminated. It seems to operate kinda like a virtual console. Create Screen Session Create a new session with &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/linux-screen-create-connect-disconnect-terminate-sessions\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[7,812,1016,1017],"class_list":["post-3338","post","type-post","status-publish","format-standard","hentry","category-command-line","category-linux","tag-linux-2","tag-screen","tag-screens","tag-sessions"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=3338"}],"version-history":[{"count":3,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3338\/revisions"}],"predecessor-version":[{"id":3341,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/3338\/revisions\/3341"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=3338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=3338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=3338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}