{"id":50928,"date":"2023-10-21T10:33:29","date_gmt":"2023-10-21T02:33:29","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=50928"},"modified":"2023-10-21T10:33:29","modified_gmt":"2023-10-21T02:33:29","slug":"screen-example","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/screen-example.html","title":{"rendered":"screen \u547d\u4ee4\u4f7f\u7528"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nscreen \u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u547d\u4ee4\uff0c\u63d0\u4f9b\u4ece\u5355\u4e2a SSH \u4f1a\u8bdd\u4e2d\u4f7f\u7528\u591a\u4e2a shell \u7a97\u53e3\uff08\u4f1a\u8bdd\uff09\u7684\u80fd\u529b\u3002\u5f53\u4f1a\u8bdd\u88ab\u5206\u79bb\u6216\u7f51\u7edc\u4e2d\u65ad\u65f6\uff0cscreen \u4f1a\u8bdd\u4e2d\u542f\u52a8\u7684\u8fdb\u7a0b\u4ecd\u5c06\u8fd0\u884c\uff0c\u4f60\u53ef\u4ee5\u968f\u65f6\u91cd\u65b0\u8fde\u63a5\u5230 screen \u4f1a\u8bdd<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"screen<\/p>\n

screen<\/span> \u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u547d\u4ee4\uff0c\u63d0\u4f9b\u4ece\u5355\u4e2a SSH \u4f1a\u8bdd\u4e2d\u4f7f\u7528\u591a\u4e2a shell \u7a97\u53e3\uff08\u4f1a\u8bdd\uff09\u7684\u80fd\u529b\u3002\u5f53\u4f1a\u8bdd\u88ab\u5206\u79bb\u6216\u7f51\u7edc\u4e2d\u65ad\u65f6\uff0cscreen \u4f1a\u8bdd\u4e2d\u542f\u52a8\u7684\u8fdb\u7a0b\u4ecd\u5c06\u8fd0\u884c\uff0c\u4f60\u53ef\u4ee5\u968f\u65f6\u91cd\u65b0\u8fde\u63a5\u5230 screen \u4f1a\u8bdd\u3002\u5982\u679c\u4f60\u60f3\u8fd0\u884c\u4e00\u4e2a\u6301\u4e45\u7684\u8fdb\u7a0b\u6216\u8005\u4ece\u591a\u4e2a\u4f4d\u7f6e\u8fde\u63a5\u5230 shell \u4f1a\u8bdd\uff0c\u8fd9\u4e5f\u5f88\u65b9\u4fbf\u3002<\/p>\n

\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5c55\u793a\u5728 Linux \u4e0a\u5b89\u88c5\u548c\u4f7f\u7528 screen<\/span> \u7684\u57fa\u672c\u77e5\u8bc6\u3002<\/p>\n

\u5982\u4f55\u5b89\u88c5 screen<\/strong><\/div>\n
screen<\/pre>\n

\u5728\u4e00\u4e9b\u6d41\u884c\u7684\u53d1\u884c\u7248\u4e0a\u5df2\u7ecf\u9884\u5b89\u88c5\u4e86\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u5728\u4f60\u7684\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86\u3002<\/p>\n

screen -v\r\nScreen version 4.00.03 (FAU)\r\n<\/pre>\n

\u5982\u679c\u5728 Linux \u4e2d\u8fd8\u6ca1\u6709screen<\/span> \uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u7cfb\u7edf\u63d0\u4f9b\u7684\u5305\u7ba1\u7406\u5668\u5f88\u7b80\u5355\u5730\u5b89\u88c5\u5b83\u3002<\/p>\n

CentOS\/RedHat\/Fedora<\/strong><\/p>\n

yum -y install screen\r\n<\/pre>\n

Ubuntu\/Debian<\/strong><\/p>\n

apt-get -y install screen\r\n<\/pre>\n
\u5982\u4f55\u542f\u52a8\u4e00\u4e2a screen \u4f1a\u8bdd<\/strong><\/div>\n

\u4f60\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165 screen<\/span> \u6765\u542f\u52a8\u5b83\uff0c\u63a5\u7740\u4f1a\u6709\u4e00\u4e2a\u770b\u4e0a\u53bb\u548c\u547d\u4ee4\u884c\u63d0\u793a\u7b26\u4e00\u6837\u7684 screen<\/span> \u4f1a\u8bdd\u542f\u52a8\u3002<\/p>\n

screen\r\n<\/pre>\n

\u4f7f\u7528\u63cf\u8ff0\u6027\u540d\u79f0\u542f\u52a8\u5c4f\u5e55\u4f1a\u8bdd\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u505a\u6cd5\uff0c\u8fd9\u6837\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u8bb0\u4f4f\u4f1a\u8bdd\u4e2d\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002\u8981\u4f7f\u7528\u4f1a\u8bdd\u540d\u79f0\u521b\u5efa\u65b0\u4f1a\u8bdd\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

screen -S name\r\n<\/pre>\n

\u5c06 \u201cname\u201d \u66ff\u6362\u4e3a\u5bf9\u4f60\u4f1a\u8bdd\u6709\u610f\u4e49\u7684\u540d\u5b57\u3002<\/p>\n

\u4ece screen \u4f1a\u8bdd\u4e2d\u5206\u79bb<\/strong><\/div>\n

\u8981\u4ece\u5f53\u524d\u7684 screen \u4f1a\u8bdd\u4e2d\u5206\u79bb\uff0c\u4f60\u53ef\u4ee5\u6309\u4e0bCtrl-A<\/span> \u548c d<\/span>\u3002\u6240\u6709\u7684 screen \u4f1a\u8bdd\u4ecd\u5c06\u662f\u6d3b\u8dc3\u7684\uff0c\u4f60\u4e4b\u540e\u53ef\u4ee5\u968f\u65f6\u91cd\u65b0\u8fde\u63a5\u3002<\/p>\n

\u91cd\u65b0\u8fde\u63a5\u5230 screen \u4f1a\u8bdd<\/strong><\/div>\n

\u5982\u679c\u4f60\u4ece\u4e00\u4e2a\u4f1a\u8bdd\u5206\u79bb\uff0c\u6216\u8005\u7531\u4e8e\u67d0\u4e9b\u539f\u56e0\u4f60\u7684\u8fde\u63a5\u88ab\u4e2d\u65ad\u4e86\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u91cd\u65b0\u8fde\u63a5\uff1a<\/p>\n

screen -r\r\n<\/pre>\n

\u5982\u679c\u4f60\u6709\u591a\u4e2a screen \u4f1a\u8bdd\uff0c\u4f60\u53ef\u4ee5\u7528 ls<\/span> \u53c2\u6570\u5217\u51fa\u5b83\u4eec\u3002<\/p>\n

screen -ls\r\n\r\nThere are screens on:\r\n7880.session\u00a0\u00a0\u00a0 (Detached)\r\n7934.session2\u00a0\u00a0 (Detached)\r\n7907.session1\u00a0\u00a0 (Detached)\r\n3 Sockets in \/var\/run\/screen\/S-root.<\/pre>\n

\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u6709\u4e09\u4e2a\u6d3b\u8dc3\u7684 screen \u4f1a\u8bdd\u3002\u56e0\u6b64\uff0c\u5982\u679c\u4f60\u60f3\u8981\u8fd8\u539f \u201csession2\u201d \u4f1a\u8bdd\uff0c\u4f60\u53ef\u4ee5\u6267\u884c\uff1a<\/p>\n

screen -r 7934\r\n<\/pre>\n

\u6216\u8005\u4f7f\u7528 screen \u540d\u79f0\u3002<\/p>\n

screen -r -S session2\r\n<\/pre>\n
\u4e2d\u6b62 screen \u4f1a\u8bdd<\/strong><\/div>\n

\u6709\u51e0\u79cd\u65b9\u6cd5\u6765\u4e2d\u6b62 screen \u4f1a\u8bdd\u3002\u4f60\u53ef\u4ee5\u6309\u4e0b Ctrl+d<\/span> \uff0c\u6216\u8005\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528 exit<\/span> \u547d\u4ee4\u3002<\/p>\n

\u8981\u67e5\u770bscreen<\/span>\u547d\u4ee4\u6240\u6709\u6709\u7528\u7684\u529f\u80fd\uff0c\u4f60\u53ef\u4ee5\u67e5\u770b screen<\/span> \u7684 man \u624b\u518c\u3002<\/p>\n

man screen\r\n\r\nNAME\r\nscreen - screen manager with VT100\/ANSI terminal emulation\r\n\r\nSYNOPSIS\r\nscreen [ -options ] [ cmd [ args ] ]\r\nscreen -r [[pid.]tty[.host]]\r\nscreen -r sessionowner\/[[pid.]tty[.host]]\r\n<\/pre>\n

\u987a\u4fbf\u8bf4\u4e00\u4e0b\uff0c\u5982\u679c\u4f60\u559c\u6b22\u8fd9\u7bc7\u6587\u7ae0\uff0c\u8bf7\u5728\u793e\u4ea4\u7f51\u7edc\u4e0a\u4e0e\u4f60\u7684\u670b\u53cb\u5206\u4eab\uff0c\u6216\u8005\u5728\u8bc4\u8bba\u533a\u7559\u4e0b\u8bc4\u8bba\u3002\u8c22\u8c22\u3002<\/p>\n


\n

via: https:\/\/www.rosehosting.com\/blog\/basic-screen-command-usage-and-examples\/<\/a><\/p>\n

\u4f5c\u8005\uff1arosehosting.com<\/a> \u8bd1\u8005\uff1ageekpi<\/a> \u6821\u5bf9\uff1ajasminepeng<\/a><\/p>\n

\u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-8215-1.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/screen-example.html<\/a>\u7f16\u8f91\u5458\uff1a\u5f20\u96c4\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

screen \u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u547d\u4ee4\uff0c\u63d0\u4f9b\u4ece\u5355\u4e2a SSH \u4f1a\u8bdd\u4e2d\u4f7f\u7528\u591a\u4e2a shell \u7a97\u53e3\uff08\u4f1a\u8bdd\uff09\u7684\u80fd\u529b\u3002\u5f53\u4f1a\u8bdd\u88ab\u5206\u79bb\u6216\u7f51\u7edc\u4e2d\u65ad\u65f6\uff0cscreen \u4f1a\u8bdd\u4e2d\u542f\u52a8\u7684\u8fdb\u7a0b\u4ecd\u5c06\u8fd0\u884c\uff0c\u4f60\u53ef\u4ee5\u968f\u65f6\u91cd\u65b0\u8fde\u63a5\u5230 screen \u4f1a\u8bdd\u3002\u5982\u679c\u4f60\u60f3\u8fd0\u884c\u4e00\u4e2a\u6301\u4e45\u7684\u8fdb\u7a0b\u6216\u8005\u4ece\u591a\u4e2a\u4f4d\u7f6e\u8fde\u63a5\u5230 shell \u4f1a\u8bdd\uff0c\u8fd9\u4e5f\u5f88\u65b9\u4fbf\u3002<\/p>\n","protected":false},"author":643,"featured_media":81451,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-50928","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/50928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/643"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=50928"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/50928\/revisions"}],"predecessor-version":[{"id":81493,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/50928\/revisions\/81493"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/81451"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=50928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=50928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=50928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}