{"id":39085,"date":"2023-02-08T10:08:48","date_gmt":"2023-02-08T02:08:48","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=39085"},"modified":"2023-02-08T10:08:48","modified_gmt":"2023-02-08T02:08:48","slug":"run-linuxcommand-backend","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/run-linuxcommand-backend.html","title":{"rendered":"\u5982\u4f55\u5728\u540e\u53f0\u8fd0\u884c Linux \u547d\u4ee4\u5e76\u4e14\u5c06\u8fdb\u7a0b\u8131\u79bb\u7ec8\u7aef"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u4e0e\u7ec8\u7aef\u5173\u8054\u5728\u4e00\u8d77\u65f6\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e24\u79cd\u95ee\u9898\uff1a1. \u4f60\u7684\u63a7\u5236\u7ec8\u7aef\u5145\u6ee1\u4e86\u5f88\u591a\u8f93\u51fa\u6570\u636e\u6216\u8005\u9519\u8bef\u53ca\u8bca\u65ad\u4fe1\u606f 2. \u5982\u679c\u53d1\u751f\u7ec8\u7aef\u5173\u95ed\u7684\u60c5\u51b5\uff0c\u8fdb\u7a0b\u8fde\u540c\u5b83\u7684\u5b50\u8fdb\u7a0b\u90fd\u5c06\u4f1a\u7ec8\u6b62\u3002\u4e3a\u4e86\u89e3\u51b3\u4e0a\u9762\u4e24\u4e2a\u95ee\u9898\uff0c\u4f60\u9700\u8981\u4ece\u4e00\u4e2a\u63a7\u5236\u7ec8\u7aef\u5b8c\u5168\u8131\u79bb\u4e00\u4e2a\u8fdb\u7a0b\u3002\u5728\u6211\u4eec\u5b9e\u9645\u4e0a\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u4e4b\u524d\uff0c\u8ba9\u6211\u4eec\u5148\u7b80\u8981\u7684\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5982\u4f55\u5728\u540e\u53f0\u8fd0\u884c\u4e00\u4e2a\u8fdb\u7a0b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5982\u4f55\u5728\u540e\u53f0\u5f00\u59cb\u4e00\u4e2a Linux \u8fdb\u7a0b\u6216\u8005\u547d\u4ee4\u884c<\/strong><\/div>\n

\u5982\u679c\u4e00\u4e2a\u8fdb\u7a0b\u5df2\u7ecf\u8fd0\u884c\uff0c\u4f8b\u5982tar \u547d\u4ee4\u884c\u7684\u4f8b\u5b50\uff0c\u7b80\u5355\u7684\u6309\u4e0b Ctrl+Z \u5c31\u53ef\u4ee5\u505c\u6b62\u5b83\uff08\u8fd9\u91cc\u8bf4\u7684“\u505c\u6b62”\uff0c\u4e0d\u662f\u7ec8\u6b62\uff0c\u800c\u662f“\u6682\u505c”\u7684\u610f\u601d\uff09\uff0c\u7136\u540e\u8f93\u5165\u547d\u4ee4 bg \u5c31\u53ef\u4ee5\u7ee7\u7eed\u4ee5\u4e00\u4e2a\u4efb\u52a1\u5728\u540e\u53f0\u8fd0\u884c\u4e86\u3002<\/p>\n

\u5728\u540e\u53f0\u8fd0\u884c Linux \u547d\u4ee4<\/strong><\/span><\/div>\n

\u4f60\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165 jobs \u67e5\u770b\u6240\u6709\u7684\u540e\u53f0\u4efb\u52a1\u3002\u4f46\u662f\uff0c\u6807\u51c6\u8f93\u5165\uff08STDIN\uff09\u3001\u6807\u51c6\u8f93\u51fa\uff08STDOUT\uff09\u548c\u6807\u51c6\u9519\u8bef\uff08STDERR\uff09\u4f9d\u65e7\u63ba\u6742\u5230\u63a7\u5236\u53f0\u4e2d\u3002<\/p>\n

$ tar -czf home.tar.gz .\r\n$ bg\r\n$ jobs<\/pre>\n

\"\u5982\u4f55\u5728\u540e\u53f0\u8fd0\u884c<\/p>\n

\u5728\u540e\u53f0\u5f00\u59cb\u4e00\u4e2a Linux \u8fdb\u7a0b<\/strong><\/span><\/div>\n

\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u7b26\u53f7 & \u5728\u540e\u53f0\u8fd0\u884c\u4e00\u4e2a\u8fdb\u7a0b\uff1a<\/p>\n

$ tar -czf home.tar.gz . &\r\n$ jobs<\/pre>\n

\"\u5982\u4f55\u5728\u540e\u53f0\u8fd0\u884c<\/p>\n

\u8fd0\u884c\u5728\u540e\u53f0\u7684 Linux \u8fdb\u7a0b\u4fe1\u606f<\/strong><\/span><\/div>\n

\u770b\u4e00\u4e0b\u4e0b\u9762\u7684\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u867d\u7136 tar \u547d\u4ee4\u662f\u4f5c\u4e3a\u4e00\u4e2a\u540e\u53f0\u4efb\u52a1\u5f00\u59cb\u7684\uff0c\u4f46\u662f\u9519\u8bef\u4fe1\u606f\u4f9d\u65e7\u53d1\u9001\u5230\u7ec8\u7aef\uff0c\u8fd9\u8868\u793a\uff0c\u8fdb\u7a0b\u4f9d\u65e7\u548c\u63a7\u5236\u7ec8\u7aef\u5173\u8054\u5728\u4e00\u8d77\u3002<\/p>\n

$ tar -czf home.tar.gz . &\r\n$ jobs<\/pre>\n

\"\u5982\u4f55\u5728\u540e\u53f0\u8fd0\u884c<\/p>\n

\u9000\u51fa\u63a7\u5236\u53f0\u4e4b\u540e\uff0c\u4fdd\u6301 Linux \u8fdb\u7a0b\u7684\u8fd0\u884c<\/strong><\/div>\n

\u6211\u4eec\u5c06\u4f7f\u7528 disown \u547d\u4ee4\uff0c\u5b83\u5728\u4e00\u4e2a\u8fdb\u7a0b\u5df2\u7ecf\u8fd0\u884c\u5e76\u4e14\u88ab\u653e\u5728\u540e\u53f0\u4e4b\u540e\u4f7f\u7528\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u4ece shell \u7684\u6d3b\u52a8\u4efb\u52a1\u5217\u8868\u4e2d\u79fb\u8d70\u4e00\u4e2a shell \u4efb\u52a1\uff0c\u56e0\u6b64\uff0c\u5bf9\u4e8e\u8be5\u4efb\u52a1\uff0c\u4f60\u5c06\u518d\u4e5f\u4e0d\u80fd\u4f7f\u7528 fg \u3001 bg \u547d\u4ee4\u4e86\u3002\u800c\u4e14\uff0c\u5f53\u4f60\u5173\u95ed\u63a7\u5236\u63a7\u5236\u7ec8\u7aef\uff0c\u8fd9\u4e2a\u4efb\u52a1\u5c06\u4e0d\u4f1a\u6302\u8d77\uff08\u6682\u505c\uff09\u6216\u8005\u5411\u4efb\u4f55\u4e00\u4e2a\u5b50\u4efb\u52a1\u53d1\u9001 SIGHUP \u4fe1\u53f7\u3002<\/p>\n

\u5173\u95ed\u7ec8\u7aef\u4e4b\u540e\uff0c\u4fdd\u6301 Linux \u8fdb\u7a0b\u8fd0\u884c<\/strong><\/span><\/div>\n

\u8ba9\u6211\u4eec\u770b\u4e00\u4e0b\u5148\u4e0b\u9762\u7684\u8fd9\u4e2a\u4f7f\u7528 bash \u4e2d\u5185\u7f6e\u547d\u4ee4 disown\u7684\u4f8b\u5b50\u3002<\/p>\n

$ sudo rsync Templates\/* \/var\/www\/html\/files\/ &\r\n$ jobs\r\n$ disown  -h  %1\r\n$ jobs<\/pre>\n

\"\u5982\u4f55\u5728\u540e\u53f0\u8fd0\u884c<\/p>\n

\u5173\u95ed shell \u4e4b\u540e\u628a Linux \u8fdb\u7a0b\u7f6e\u4e8e\u540e\u53f0<\/strong><\/span><\/div>\n

\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 nohup \u547d\u4ee4\uff0c\u8fd9\u4e2a\u547d\u4ee4\u4e5f\u53ef\u4ee5\u5728\u7528\u6237\u9000\u51fa shell \u4e4b\u540e\u4fdd\u8bc1\u8fdb\u7a0b\u5728\u540e\u53f0\u7ee7\u7eed\u8fd0\u884c\u3002<\/p>\n

$ nohup tar -czf iso.tar.gz Templates\/* &\r\n$ jobs<\/pre>\n

\"\u5982\u4f55\u5728\u540e\u53f0\u8fd0\u884c<\/p>\n

\u4ece\u63a7\u5236\u7ec8\u7aef\u8131\u79bb\u4e00\u4e2a Linux \u8fdb\u7a0b<\/strong><\/div>\n

\u4e3a\u4e86\u5f7b\u5e95\u4ece\u63a7\u5236\u7ec8\u7aef\u8131\u79bb\u4e00\u4e2a\u7a0b\u5e8f\uff0c\u5bf9\u4e8e\u56fe\u5f62\u7528\u6237\u754c\u9762 (GUI) \u7684\u7a0b\u5e8f\u4f8b\u5982 firefox \u6765\u8bf4\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u884c\u683c\u5f0f\u4f1a\u66f4\u6709\u6548\uff1a<\/p>\n

$ firefox <\/dev\/null &>\/dev\/null &<\/pre>\n

\u5728 Linux \u4e0a\uff0c\/dev\/null \u662f\u4e00\u4e2a\u7279\u6b8a\u7684\u6587\u4ef6\u8bbe\u5907\uff0c\u5b83\u4f1a\u5ffd\u7565\u6240\u6709\u7684\u5199\u5728\u5b83\u4e0a\u9762\u7684\u6570\u636e\uff0c\u4e0a\u8ff0\u547d\u4ee4\uff0c\u8f93\u5165\u6765\u6e90\u548c\u8f93\u51fa\u53d1\u9001\u76ee\u6807\u90fd\u662f \/dev\/null\u3002<\/p>\n

\u4f5c\u4e3a\u7ed3\u675f\u9648\u8ff0\uff0c\u8fd0\u884c\u4e00\u4e2a\u8fde\u63a5\u5230\u63a7\u5236\u7ec8\u7aef\u7684\u8fdb\u7a0b\uff0c\u4f5c\u4e3a\u7528\u6237\u4f60\u5c06\u4f1a\u5728\u4f60\u7684\u7ec8\u7aef\u4e0a\u770b\u5230\u8fd9\u4e2a\u8fdb\u7a0b\u6570\u636e\u7684\u8bb8\u591a\u884c\u7684\u8f93\u51fa\uff0c\u4e5f\u5305\u542b\u9519\u8bef\u4fe1\u606f\u3002\u540c\u6837\uff0c\u5f53\u4f60\u5173\u95ed\u4e00\u4e2a\u63a7\u5236\u7ec8\u7aef\uff0c\u4f60\u7684\u8fdb\u7a0b\u548c\u5b50\u8fdb\u7a0b\u90fd\u5c06\u4f1a\u7ec8\u6b62\u3002<\/p>\n

\n

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

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/run-linuxcommand-backend.html<\/a>\u7f16\u8f91\u5458\uff1a\u70e8\u5b50\uff0c\u5ba1\u6838\u5458\uff1a\u51af\u742a<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5728\u672c\u6307\u5357\u4e2d\uff0c\u6211\u4eec\u5c06\u4f1a\u9610\u660e\u4e00\u4e2a\u5728 Linux \u7cfb\u7edf\u4e2d\u8fdb\u7a0b\u7ba1\u7406\u7684\u7b80\u5355\u4f46\u662f\u91cd\u8981\u7684\u6982\u5ff5\uff0c\u90a3\u5c31\u662f\u5982\u4f55\u4ece\u5b83\u7684\u63a7\u5236\u7ec8\u7aef\u5b8c\u5168\u8131\u79bb\u4e00\u4e2a\u8fdb\u7a0b\u3002<\/p>\n","protected":false},"author":63,"featured_media":38932,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-39085","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\/39085","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=39085"}],"version-history":[{"count":13,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/39085\/revisions"}],"predecessor-version":[{"id":263781,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/39085\/revisions\/263781"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/38932"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=39085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=39085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=39085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}