{"id":23253,"date":"2022-11-03T09:39:36","date_gmt":"2022-11-03T01:39:36","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=23253"},"modified":"2022-11-03T09:39:37","modified_gmt":"2022-11-03T01:39:37","slug":"windows-ten-subsystem-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/windows-ten-subsystem-linux.html","title":{"rendered":"\u73a9\u8f6c Windows 10 \u4e2d\u7684 Linux \u5b50\u7cfb\u7edf"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5728\u4eca\u5e74\u7684 Build 2016 \u4e0a\uff0c\u5fae\u8f6f\u5411\u5168\u4e16\u754c\u4ecb\u7ecd\u4e86\u4ed6\u4eec\u8fd8\u5904\u4e8e Beta \u9636\u6bb5\u7684Windows \u4e0b\u7684 Linux \u5b50\u7cfb\u7edfWindows Subsystem for Linux\uff08WSL\uff09\uff0c\u5b83\u53ef\u4ee5\u8ba9\u5f00\u53d1\u8005\u4eec\u5728 Windows 10 \u4e0b\u901a\u8fc7 Bash shell \u8fd0\u884c\u539f\u751f\u7684 Ubuntu \u7528\u6237\u6001\u4e8c\u8fdb\u5236\u7a0b\u5e8f\u3002\u5982\u679c\u4f60\u53c2\u4e0e\u4e86 Windows Insider \u8ba1\u5212\uff0c\u4f60\u5c31\u53ef\u4ee5\u5728\u6700\u65b0\u7684 Windows 10 \u5e74\u5ea6\u5347\u7ea7\u7248\u7684 Insider \u6784\u5efa\u7248\u4e2d\u4f53\u9a8c\u8fd9\u4e2a\u529f\u80fd\u4e86\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"windows-linux\"<\/p>\n

Web \u5f00\u53d1\u4eba\u5458\u4eec\u4e0d\u7528\u518d\u82e6\u607c\u6240\u7528\u7684 Windows \u5f00\u53d1\u5e73\u53f0\u4e0a\u6ca1\u6709\u5408\u9002\u7684 Linux \u5de5\u5177\u548c\u5e93\u4e86\u3002WSL \u662f\u7531 Windows \u5185\u6838\u56e2\u961f\u4e0e Canonical \u5408\u4f5c\u8bbe\u8ba1\u548c\u5f00\u53d1\u7684\uff0c\u53ef\u4ee5\u8ba9 Windows 10 \u4e0b\u7684\u5f00\u53d1\u8005\u4eec\u5728\u62e5\u6709 Windows \u4e2d\u90a3\u4e9b\u5f3a\u529b\u652f\u6301\u4e4b\u5916\uff0c\u8fd8\u80fd\u4f7f\u7528 Linux \u4e0b\u4e30\u5bcc\u7684\u5f00\u53d1\u73af\u5883\u4e0e\u5de5\u5177\uff0c\u800c\u4e0d\u7528\u542f\u52a8\u5230\u53e6\u5916\u7684\u64cd\u4f5c\u7cfb\u7edf\u6216\u8005\u4f7f\u7528\u865a\u62df\u673a\u3002\u8fd9\u7edd\u5bf9\u662f\u4e00\u4e2a\u201c\u6765\u81ea\u5f00\u53d1\u8005\uff0c\u670d\u52a1\u5f00\u53d1\u8005\u201d\u7684 Windows 10 \u7279\u8272\uff0c\u5b83\u7684\u76ee\u7684\u662f\u8ba9\u5f00\u53d1\u8005\u4eec\u6bcf\u5929\u7684\u5f00\u53d1\u5de5\u4f5c\u90fd\u53d8\u5f97\u987a\u7545\u800c\u4fbf\u6377\u3002<\/p>\n

\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4f1a\u5c55\u793a\u7ed9\u4f60\u4e00\u4e9b\u6211\u8ba4\u4e3a\u975e\u5e38\u6709\u8da3\u7684\u529f\u80fd\uff0c\u4ee5\u53ca\u544a\u8bc9\u4f60\u4e00\u4e9b\u53ef\u4ee5\u8ba9\u4f60\u627e\u5230\u66f4\u591a\u4fe1\u606f\u7684\u8d44\u6e90\u3002\u9996\u5148\uff0c\u6211\u4f1a\u5c55\u793a WSL \u6240\u96c6\u6210\u7684\u90a3\u4e9b\u4e3b\u8981\u547d\u4ee4\uff08\u6bd4\u5982 ssh\uff09\u662f\u5982\u4f55\u64cd\u4f5c\u670d\u52a1\u5668\u548c\u8bbe\u5907\u7684\u3002\u5176\u6b21\uff0c\u6211\u4f1a\u6f14\u793a\u4f7f\u7528 Bash \u811a\u672c\u662f\u5982\u4f55\u4ee5\u7b80\u660e\u7684\u65b9\u5f0f\u6765\u81ea\u52a8\u5316\u6267\u884c\u4efb\u52a1\u7684\u3002\u5176\u4e09\uff0c\u6211\u4f1a\u5229\u7528\u6781\u68d2\u7684\u547d\u4ee4\u884c\u7f16\u8bd1\u5668\u3001\u4e00\u4e9b\u5176\u5b83\u5de5\u5177\u4ee5\u53ca\u5bf9 *nix \u517c\u5bb9\u7684\u80fd\u529b\u6765\u73a9\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u53e4\u5178\u9ed1\u5ba2\u7ea7\u6e38\u620f\uff1a NetHack\u3002\u6700\u540e\uff0c\u6211\u4f1a\u5c55\u793a\u5982\u4f55\u4f7f\u7528\u5df2\u6709\u7684 Python \u811a\u672c\u548c\u5176\u5b83\u6765\u81ea\u7f51\u4e0a\u7684\u811a\u672c\u3002<\/p>\n

\u4ece\u6211\u7684\u7b2c\u4e00\u53f0 286 \u4e0a\u8fd0\u884c\u7684 Windows 3.0 \u5f00\u59cb\uff0cWindows \u5c31\u4e00\u76f4\u662f\u6211\u7684\u4e3b\u8981\u64cd\u4f5c\u7cfb\u7edf\u548c\u5f00\u53d1\u73af\u5883\u3002\u4e0d\u8fc7\uff0c\u6211\u8eab\u8fb9\u4e5f\u6709\u5f88\u591a Linux \u670d\u52a1\u5668\u548c\u8bbe\u5907\u3002\u4ece\u6811\u8393\u6d3e\u548c\u8def\u7531\u5668\/\u7f51\u5173\u8bbe\u5907\u8fd9\u6837\u7684\u7269\u8054\u7f51\u8bbe\u5907\uff0c\u5230 Minecraft \u670d\u52a1\u5668\uff0c\u5b83\u4eec\u5806\u6ee1\u4e86\u6211\u7684\u529e\u516c\u5ba4\u7684\u6bcf\u4e2a\u89d2\u843d\u3002\u800c\u6211\u7ecf\u5e38\u8981\u4ece\u6211\u7684\u4e3b\u5de5\u4f5c\u7ad9\u4e2d\u53bb\u7ba1\u7406\u548c\u914d\u7f6e\u8fd9\u4e9b Linux \u8ba1\u7b97\u673a\u3002<\/p>\n

\u7ba1\u7406\u670d\u52a1\u5668\u548c\u8bbe\u5907<\/strong><\/div>\n

\u6211\u5728\u6211\u7684\u5bb6\u4e2d\u8fd0\u884c\u7740\u4e00\u53f0\u65e0\u663e\u793a\u5668\u7684 Ubuntu Minecraft \u670d\u52a1\u5668\uff0c\u8fd9\u662f\u6211\u53bb\u5e74\u7ed9\u6211\u5341\u5c81\u5927\u7684\u513f\u5b50\u7684\u5723\u8bde\u793c\u7269\uff0c\u4f46\u662f\u5b83\u5df2\u7ecf\u53d8\u6210\u4e86\u6211\u7684\u73a9\u5177\u800c\u4e0d\u662f\u4ed6\u7684\uff08\u597d\u5427\uff0c\u4e3b\u8981\u662f\u6211\u7684\u73a9\u5177\uff09\u3002\u6211\u4ee5\u524d\u5728\u6211\u7684 Windows 10 \u7535\u8111\u4e0a\u4f7f\u7528\u51e0\u4e2a\u5ba2\u6237\u7aef\u6765\u7ba1\u7406\u5b83\uff0c\u4e0d\u8fc7\u6211\u73b0\u5728\u60f3\u4f7f\u7528 Windows \u4e2d\u7684 Bash \u91cc\u9762\u7684 ssh \u547d\u4ee4\u884c\u6765\u7ba1\u7406\u5b83\u3002\u4f7f\u7528\u7c7b\u4f3c PuTTY \u6216\u6765\u81ea Cygwin \u7684 Tera Term \u8fd9\u6837\u7684\u5e94\u7528\u5f53\u7136\u4e5f\u53ef\u4ee5\uff0c\u4f46\u662f\u6211\u60f3\u8bd5\u8bd5\u771f\u6b63\u539f\u751f\u800c\u81ea\u7136\u7684\u4f53\u9a8c\u4e5f\u662f\u4e00\u79cd\u4e0d\u9519\u7684\u9009\u62e9\u3002Cygwin \u5c31\u50cf\u662f\u5728\u62ab\u8428\u5e97\u8ba2\u8d2d\u7684\u62ab\u8428\u4e00\u6837\uff0c\u597d\u5403\uff0c\u4f46\u662f\u6ca1\u6709\u90a3\u79cd\u6c1b\u56f4\u3002<\/p>\n

\u6211\u5df2\u7ecf\u4f7f\u7528 WSL \u4e2d\u7684<\/p>\n

ssh-keygen<\/pre>\n

\u548c<\/p>\n

ssh-copy-id<\/pre>\n

\u8bbe\u7f6e\u597d\u4e86\u516c\u79c1\u5bc6\u94a5\u5bf9\uff0c\u6240\u4ee5\u4f7f\u7528 ssh \u53ea\u9700\u8981\u5982\u4e0b\u7b80\u5355\u8f93\u5165\u5373\u53ef\uff1a<\/p>\n

$ ssh <username>@<server><\/pre>\n

\u6211\u8fd8\u4e3a\u6b64\u521b\u5efa\u4e86\u4e00\u4e2a\u522b\u540d\uff0c\u4ee5\u4fbf\u66f4\u5feb\u4e00\u4e9b\u3002\u8fd9\u662f\u4e00\u4e2a\u6807\u51c6\u7684 Linux\/Bash \u529f\u80fd\uff1a<\/p>\n

$ alias mc='ssh <user>@<server>'<\/pre>\n

\u73b0\u5728\uff0c\u6211\u8981\u8bbf\u95ee\u6211\u7684 Minecraft \u670d\u52a1\u5668\u53ea\u9700\u8981\u5728 Windows 10 \u4e0b\u7684 Bash \u4e2d\u8f93\u5165\u201cmc\u201d\u5373\u53ef\u3002<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u5f53\u7136\uff0c\u540c\u6837\u7684\u65b9\u6cd5\u4f60\u4e5f\u53ef\u4ee5\u7528\u4e8e\u4efb\u4f55 Linux \u4e0a\u7684 Web \u6216\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\uff0c\u751a\u81f3\u6811\u8393\u6d3e\u6216\u5176\u5b83\u7684\u7269\u8054\u7f51\u8bbe\u5907\u4e5f\u53ef\u4ee5\u3002
\n\u5728\u7ec8\u7aef\u91cc\u9762\u8fdb\u884c ssh \u53ea\u662f\u4e3a\u4e86\u65b9\u4fbf\u800c\u5df2\uff0c\u4e0d\u8fc7\u5f53\u4f60\u5728 shell \u4e2d\u5de5\u4f5c\u65f6\uff0c\u5982\u679c\u8fd8\u6709\u7c7b\u4f3c apt\u3001node\u3001Ruby\u3001Python \u7b49\u7b49\u5de5\u5177\u65f6\uff0c\u4f60\u5c31\u6709\u4e86\u81ea\u52a8\u5316\u5404\u79cd\u5de5\u4f5c\u7684\u53ef\u80fd\u3002<\/p>\n

\u8fdc\u7a0b\u811a\u672c<\/strong><\/div>\n

\u5047\u5982\u8bf4\u4f60\u6709\u4e00\u5927\u5806 Linux \u670d\u52a1\u5668\u548c\u8bbe\u5907\uff0c\u800c\u4f60\u8981\u5728\u5b83\u4eec\u4e0a\u9762\u6267\u884c\u4e00\u4e2a\u8fdc\u7a0b\u547d\u4ee4\u7684\u8bdd\uff0c\u5982\u679c\u5df2\u7ecf\u914d\u7f6e\u597d\u516c\u79c1\u5bc6\u94a5\u5bf9\uff0c\u4f60\u5c31\u53ef\u4ee5\u5728 Bash \u4e2d\u76f4\u63a5\u8fdc\u7a0b\u6267\u884c\u547d\u4ee4\u3002<\/p>\n

\u4e3e\u4e2a\u4f8b\u5b50\u8bf4\uff0c\u60f3\u77e5\u9053\u8fdc\u7a0b\u670d\u52a1\u5668\u81ea\u4ece\u4e0a\u6b21\u91cd\u542f\u540e\u5df2\u7ecf\u8fd0\u884c\u4e86\u591a\u957f\u65f6\u95f4\u4e86\uff0c\u4f60\u53ea\u9700\u8981\u8f93\u5165\uff1a<\/p>\n

$ ssh <user>@<server> 'last -x|grep reboot'<\/pre>\n

ssh \u4f1a\u8fde\u63a5\u5230\u8be5\u670d\u52a1\u5668\u5e76\u6267\u884c<\/p>\n

last -x<\/pre>\n

\u547d\u4ee4\uff0c\u7136\u540e\u641c\u7d22\u5305\u542b\u201creboot\u201d\u7684\u4e00\u884c\u3002\u6211\u5728\u6211\u7684 Ubuntu Minecraft \u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n

reboot\u00a0\u00a0 system boot\u00a0 4.4.0-28-generic Thu Jul\u00a0 7 08:14\u00a0\u00a0 still running<\/pre>\n

\u8fd9\u53ea\u662f\u4e00\u53f0\u670d\u52a1\u5668\uff0c\u5982\u679c\u4f60\u6709\u8bb8\u591a\u670d\u52a1\u5668\u7684\u8bdd\uff0c\u4f60\u53ef\u4ee5\u81ea\u52a8\u5316\u8fd9\u4e2a\u8fc7\u7a0b\u3002\u6211\u5728 WSL \u91cc\u6211\u7684\u4e3b\u76ee\u5f55\u4e0b\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3a servers.txt \u7684\u6587\u4ef6\uff0c\u5b83\u5305\u542b\u4e86\u4e00\u7cfb\u5217 Linux \u670d\u52a1\u5668\/\u8bbe\u5907\u7684\u540d\u79f0\uff0c\u6bcf\u4e2a\u4e00\u884c\u3002\u7136\u540e\u6211\u5c31\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u811a\u672c\u6765\u8bfb\u53d6\u8fd9\u4e2a\u6587\u4ef6\u3002<\/p>\n

\u5728\u4f7f\u7528\u4e86\u5f88\u591a\u5e74\u50cf\u6811\u8393\u6d3e\u8fd9\u6837\u7684\u8bbe\u5907\u4e4b\u540e\uff0c\u6211\u5df2\u7ecf\u53d8\u6210\u4e86\u4e00\u4e2a nano \u4eba\uff08\u5728 VMS \u4e0a\u6211\u662f\u4e00\u4e2a LSEdit \u4eba\uff09\uff0c\u4e0b\u9762\u662f\u6211\u7528\u6211\u559c\u7231\u7684 nano \u7f16\u8f91\u5668\u6253\u5f00\u7684\u811a\u672c\u3002<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 vim \u3001 emacs \u6216\u8005\u5176\u5b83\u53ef\u4ee5\u7528\u5728 Ubuntu \u7ec8\u7aef\u4e0a\u7684\u7f16\u8f91\u5668\u3002<\/p>\n

\u8be5\u811a\u672c\u662f Bash \u811a\u672c\uff0c\u8981\u6267\u884c\u8be5\u811a\u672c\uff0c\u8f93\u5165\uff1a<\/p>\n

$ .\/foreachserver.sh 'last -x|grep reboot'<\/pre>\n

\u5b83\u5c06\u8fed\u4ee3\u8f93\u51fa\u6587\u4ef6\u4e2d\u7684\u6bcf\u4e2a\u670d\u52a1\u5668\/\u8bbe\u5907\uff0c\u7136\u540e\u901a\u8fc7 ssh \u8fdc\u7a0b\u6267\u884c\u8be5\u547d\u4ee4\u3002\u5f53\u7136\uff0c\u8fd9\u4e2a\u4f8b\u5b50\u975e\u5e38\u7b80\u5355\uff0c\u4f46\u662f\u4f60\u53ef\u4ee5\u50cf\u8fd9\u6837\u628a\u4f60\u7684\u672c\u5730\u811a\u672c\u6216\u5176\u5b83\u547d\u4ee4\u53d8\u6210\u8fdc\u7a0b\u7684\u3002Bash \u811a\u672c\u8bed\u8a00\u8db3\u591f\u4e30\u5bcc\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u5b8c\u6210\u4f60\u7684\u5927\u591a\u6570\u8fdc\u7a0b\u7ba1\u7406\u4efb\u52a1\u3002\u4f60\u53ef\u4ee5\u7528\u4f60\u4e0b\u8f7d\u5230 WSL \u6216\u8fdc\u7a0b\u7cfb\u7edf\u4e2d\u7684\u5176\u5b83\u5e94\u7528\u6765\u6269\u5c55\u5b83\u7684\u4f7f\u7528\u3002<\/p>\n

\u4f60\u662f\u5426\u9700\u8981\u5728\u5de5\u4f5c\u4e2d\u628a\u672c\u5730\u7684 Windows \u6587\u4ef6\u6216\u8d44\u6e90\u7528\u4e8e\u5176\u5b83\u7684 Linux \u8ba1\u7b97\u673a\u5417\uff1f\u6216\u8005\uff0c\u4f60\u6839\u672c\u4e0d\u4f7f\u7528 Linux \uff1fBash \u53ef\u4ee5\u64cd\u4f5c\u672c\u5730\u7684 Windows \u6587\u4ef6\u6216\u8d44\u6e90\uff0c\u8fd8\u662f\u8bf4\u5b83\u5c31\u662f\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u7684\u73af\u5883\uff1f<\/p>\n

\u4f7f\u7528 Windows \u6587\u4ef6<\/strong><\/div>\n

WSL \u7cfb\u7edf\u53ef\u4ee5\u901a\u8fc7<\/p>\n

\/mnt\/<\u76d8\u53f7>\/<\/pre>\n

\u76ee\u5f55\uff08\u6302\u8f7d\u70b9\uff09\u6765\u8bbf\u95ee\u4f60\u8ba1\u7b97\u673a\u4e0a\u7684\u6587\u4ef6\u7cfb\u7edf\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4f60\u7684 Windows \u4e0a\u7684 C:\/ \u548c D:\/ \u6839\u76ee\u5f55\u53ef\u4ee5\u5728 WSL \u4e2d\u76f8\u5e94\u5730\u901a\u8fc7 \/mnt\/c \u548c \/mnt\/d \u8bbf\u95ee\u3002\u5f53\u4f60\u8981\u628a\u4f60\u7684 Windows \u4e0b\u7684\u9879\u76ee\u6587\u4ef6\u3001\u4e0b\u8f7d\u7684\u5185\u5bb9\u548c\u5176\u5b83\u6587\u4ef6\u7528\u5230 Linux\/Bash \u4e4b\u4e2d\u65f6\u8fd9\u5f88\u6709\u7528\u3002<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u4e0a\u56fe\u663e\u793a\u7684\u4e24\u4e2a\u76ee\u5f55\u5206\u522b\u5bf9\u5e94\u4e8e\u6211\u7684\u8ba1\u7b97\u673a\u4e0a\u7684 SSD \u548c\u786c\u76d8\uff1a<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u8fd9\u662f\u903b\u8f91\u6302\u8f7d\uff0c\u6240\u4ee5\u5f53\u4f60\u5728 shell \u4e2d\u4f7f\u7528\u7c7b\u4f3c mount<\/code> \u8fd9\u6837\u7684\u547d\u4ee4\u65f6\u5b83\u4eec\u4e0d\u4f1a\u663e\u793a\u3002\u4f46\u662f\u5b83\u4eec\u53ef\u4ee5\u5982\u4f60\u9884\u671f\u7684\u90a3\u6837\u5de5\u4f5c\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5728 Windows \u4e2d\uff0c\u6211\u5728\u6211\u7684 C \u76d8\u6839\u76ee\u5f55\u4e0b\u653e\u4e86\u4e00\u4e2a\u540d\u4e3a test.txt \u7684\u6587\u4ef6\uff0c\u6211\u53ef\u4ee5\u5728 WSL \u4e2d\u5982\u4e0b\u8bbf\u95ee\u5b83\uff1a<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u5728 Build \u00a0Tour \u5927\u4f1a\u671f\u95f4\uff0c\u6211\u4eec\u8981\u786e\u4fdd\u6240\u6709\u7684\u6f14\u793a\u90fd\u53ef\u4ee5\u5728\u6ca1\u6709\u4e92\u8054\u7f51\u65f6\u4e5f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff08\u4f60\u7edd\u4e0d\u4f1a\u77e5\u9053\u4f1a\u573a\u7684\u7f51\u7edc\u662f\u4ec0\u4e48\u6837\u5b50\u7684\uff09 \uff0c\u6240\u4ee5\u4e3a\u4e86\u8ba9 Bash\/WSL \u53ef\u4ee5\u6f14\u793a Git \u64cd\u4f5c\uff0c\u8be5\u6f14\u793a\u8bbf\u95ee\u7684\u662f\u672c\u5730\u8ba1\u7b97\u673a\u4e0a\u7684 Windows \u6587\u4ef6\uff0c\u6211\u5728 Windows \u4e0a\u7684 C:\/git\/NetHack \u4e0b\u8bbe\u7f6e\u4e00\u4e2a\u672c\u5730\u4ed3\u5e93\u3002 \u8981\u5728 WSL \u4e2d\u8fdb\u884c clone \u64cd\u4f5c\uff0c\u6211\u6267\u884c\u4e86\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n

$ git \u2013clone file:\/\/\/mnt\/c\/git\/NetHack<\/pre>\n

\u8be5\u547d\u4ee4\u544a\u8bc9 git \u4f7f\u7528<\/p>\n

file:\/\/<\/pre>\n

\u534f\u8bae\uff0c\u5e76 clone \u4e86\u4f4d\u4e8e\u00a0\/mnt\/c\/git\/NetHack \u4e0b\u7684\u4ed3\u5e93\u3002\u4f60\u53ef\u4ee5\u4ee5\u7c7b\u4f3c\u7684\u65b9\u5f0f\u6765\u8bbf\u95ee\u4f60\u7684 Windows \u4e0b\u7684\u6240\u6709\u6587\u4ef6\u3002<\/p>\n

\u8b66\u793a\uff1a\u5c31\u50cf\u5728\u5176\u5b83\u7ec8\u7aef\u4e2d\u4e00\u6837\uff0c\u5982\u679c\u4f60\u4e0d\u5c0f\u5fc3\u7684\u8bdd\uff0c\u4f60\u53ef\u4ee5\u5728 Bash \u4e2d\u4fee\u6539\/\u5220\u9664 Windows \u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6587\u4ef6\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4f60\u53ef\u4ee5\u50cf\u4e0b\u9762\u8fd9\u6837\u6765\u5e72\u6389\u4f60\u7684 Windows \uff0c\u5047\u5982\u4f60\u6709\u5408\u9002\u7684\u6743\u9650\u7684\u8bdd\u3002<\/p>\n

$ rm -rf \/mnt\/c\/  [\u5343\u4e07\u522b\u8bd5\uff01][\u5343\u4e07\u522b\u8bd5\uff01][\u5343\u4e07\u522b\u8bd5\uff01]<\/pre>\n

\u6211\u4e4b\u6240\u4ee5\u90d1\u91cd\u63d0\u9192\u662f\u56e0\u4e3a\u6211\u4eec\u5f88\u591a\u4eba\u90fd\u662f\u521a\u521a\u63a5\u89e6 Linux \u547d\u4ee4\uff0c\u5b83\u4eec\u4e0d\u662f Windows \u547d\u4ee4\u3002<\/p>\n

\u8fd9\u79cd\u53ef\u4ee5\u8ba9\u6587\u4ef6\u7cfb\u7edf\u96c6\u6210\u5230\u4e00\u8d77\u7684\u9b54\u6cd5\u6765\u81ea DrvFs\u3002\u5982\u679c\u4f60\u5e0c\u671b\u4e86\u89e3\u8be5\u6587\u4ef6\u7cfb\u7edf\u7684\u66f4\u591a\u7ec6\u8282\uff0c\u4ee5\u53ca\u5b83\u662f\u5982\u4f55\u5de5\u4f5c\u5728 WSL \u4e2d\u7684\uff0cWSL \u56e2\u961f\u4e3a\u6b64\u5199\u4e86\u4e00\u7bc7\u8be6\u7ec6\u7684\u6587\u7ae0(\"https:\/\/blogs.msdn.microsoft.com\/wsl\/2016\/06\/15\/wsl-file-system-support\/\")\u3002<\/p>\n

\u5f53\u7136\uff0c \u6587\u4ef6\u7cfb\u7edf\u8bbf\u95ee\u53ea\u662f WSL \u5176\u4e2d\u7684\u4e00\u90e8\u5206\u529f\u80fd\u800c\u5df2\uff0c\u8bb8\u591a\u5f00\u53d1\u4efb\u52a1\u8fd8\u9700\u8981\u901a\u8fc7 HTTP \u6216\u5176\u5b83\u7f51\u7edc\u534f\u8bae\u8bbf\u95ee\u8fdc\u7a0b\u8d44\u6e90\u3002<\/p>\n

\u53d1\u8d77 HTTP \u8bf7\u6c42<\/strong><\/div>\n

\u4ece\u811a\u672c\u6216\u547d\u4ee4\u884c\u800c\u4e0d\u662f\u4ece\u4e00\u4e2a\u7f16\u8bd1\u597d\u7684\u7a0b\u5e8f\u6216 Web \u9875\u9762\u4e0a\u53d1\u8d77 REST \u6216\u5176\u5b83 HTTP\uff08\u6216 FTP\uff09\u8bf7\u6c42\u662f\u5f88\u6709\u7528\u7684\u3002\u5c31\u50cf\u5728\u5927\u591a\u6570 Linux \u53d1\u884c\u7248\u4e00\u6837\uff0cWSL \u4e5f\u5305\u62ec\u4e86\u7c7b\u4f3c curl \u6216 wget \u83b7\u53d6\u8d44\u6e90\u8fd9\u6837\u7684\u6807\u51c6\u529f\u80fd\uff0c\u5b83\u4eec\u53ef\u4ee5\u7528\u6765\u53d1\u8d77 HTTP \u6216\u8005\u5176\u5b83\u7f51\u7edc\u8bf7\u6c42\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4e0b\u9762\u662f\u4f7f\u7528 curl \u5bf9 Github \u53d1\u8d77 REST \u8bf7\u6c42\u6765\u83b7\u53d6\u6211\u4e2a\u4eba\u7684\u5c5e\u6027\u4fe1\u606f\uff1a<\/p>\n

$ curl -i https:\/\/api.github.com\/users\/Psychlist1972\r\nHTTP\/1.1 200 OK\r\nServer: GitHub.com\r\nDate: Wed, 13 Jul 2016 02:38:08 GMT\r\nContent-Type: application\/json; charset=utf-8\r\nContent-Length: 1319\r\nStatus: 200 OK\r\n...\r\n{\r\n  \"login\": \"Psychlist1972\",\r\n  \"avatar_url\": \"https:\/\/avatars.githubusercontent.com\/u\/1421146?v=3\",\r\n  \"url\": \"https:\/\/api.github.com\/users\/Psychlist1972\",\r\n  \"name\": \"Pete Brown\",\r\n  \"company\": \"Microsoft\",\r\n   ...\r\n}\r\n$\r\n<\/pre>\n

\u4f60\u53ef\u4ee5\u7528\u5b83\u548c Bash \u811a\u672c\u6765\u521b\u5efa\u4e00\u4e2a REST API \u7684\u5feb\u901f\u6d4b\u8bd5\u5ba2\u6237\u7aef\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u63a2\u6d4b\u4e00\u4e2a Web \u9875\u9762\u6216\u670d\u52a1\u5668\u5e76\u62a5\u544a\u5176\u8fd4\u56de\u7684\u72b6\u6001\u3002\u5b83\u7528\u6765\u4ece\u7f51\u4e0a\u4e0b\u8f7d\u6587\u4ef6\u4e5f\u5f88\u68d2\uff0c\u4f60\u53ef\u4ee5\u7b80\u5355\u5730\u91cd\u5b9a\u5411\u8f93\u51fa\u5230\u4e00\u4e2a\u6587\u4ef6\u800c\u4e0d\u662f\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b83\uff1a<\/p>\n

$ curl -i https:\/\/api.github.com\/users\/Psychlist1972 > pete.json<\/pre>\n

\u6211\u4e5f\u662f\u4e00\u4e2a PowerShell \u7528\u6237\uff0c\u751a\u81f3\u8fd8\u4f7f\u7528Windows 10 MIDI in PowerShell(\"https:\/\/github.com\/Psychlist1972\/Windows-10-PowerShell-MIDI\")\u521b\u5efa\u4e86\u4e00\u4e9b\u6709\u8da3\u7684\u6269\u5c55\uff0c\u4e5f\u4fee\u590d\u8fc7\u51fa\u73b0\u5728\u7279\u5b9a\u7684\u5f55\u97f3\u786c\u4ef6\u8bbe\u5907\u4e0a\u7684\u4e00\u4e9b\u6587\u4ef6\u95ee\u9898\u3002\u4f5c\u4e3a\u957f\u65f6\u95f4\u7684 .NET \u5f00\u53d1\u8005\u548c\u7231\u597d\u8005\uff0c\u6211\u7ecf\u5e38\u4f7f\u7528\u548c\u6269\u5c55 PowerShell \u4ee5\u6ee1\u8db3\u6211\u7684\u9879\u76ee\u9700\u6c42\u3002\u4f46\u662f \u00a0PowerShell \u5e76\u4e0d\u662f\u4e00\u4e2a\u53ef\u4ee5\u8fd0\u884c\u6240\u6709\u7684\u90a3\u4e9b Bash \u811a\u672c\u548c\u9488\u5bf9 Linux \u7684\u5f00\u6e90\u5de5\u5177\u7684\u5730\u65b9\u3002\u6211\u5e0c\u671b\u4ee5\u4e00\u79cd\u6700\u7b80\u5355\u3001\u6700\u8212\u670d\u7684\u65b9\u5f0f\u6765\u5b8c\u6210\u8fd9\u4e9b\u4efb\u52a1\uff0c\u5728\u67d0\u79cd\u610f\u4e49\u4e0a\uff0c\u8fd9\u610f\u5473\u7740\u6211\u4eec\u9700\u8981\u5728 Bash \u4e2d\u5b8c\u6210\u5b83\u4eec\u3002<\/p>\n

\u6211\u5df2\u7ecf\u4e00\u63a0\u800c\u8fc7\u7684\u4ecb\u7ecd\u4e86 Bash\u3001Bash \u811a\u672c\u4ee5\u53ca\u4f60\u53ef\u4ee5\u5728 shell \u4e2d\u5b8c\u6210\u7684\u4efb\u52a1\u3002\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u6211\u8c08\u8bba\u7684\u90fd\u662f\u6709\u52a9\u4e8e\u5f00\u53d1\u5de5\u4f5c\u7684\u90a3\u4e9b\u529f\u80fd\u3002\u4f46\u662f\u5728 WSL \u4e2d\u5b9e\u9645\u7684\u5f00\u53d1\u548c\u7f16\u8bd1\u5de5\u4f5c\u662f\u600e\u6837\u7684\uff1f\u6211\u5728 Build Tour \u5927\u4f1a\u4e0a\u6f14\u793a\u4e86\u4e0b\u9762\u8fd9\u4e2a\u90e8\u5206\u3002<\/p>\n

Build Tour \u5927\u4f1a\u4e0a\u7684\u6f14\u793a\uff1aNetHack<\/strong><\/div>\n

\u8fd9\u4e2a\u590f\u521d\uff0c\u6765\u81ea\u5fae\u8f6f\u7684\u8bb2\u6f14\u8005\u4eec\u5411\u5927\u5bb6\u6f14\u793a\u4e86\u4e00\u4e9b\u6765\u81ea Windows \u548c\u5fae\u8f6f\u4e91\u4e0a\u7684\u5f88\u9177\u7684\u5f00\u53d1\u8005\u65b0\u529f\u80fd\u3002\u4f5c\u4e3a\u5176\u4e2d\u7684\u4e00\u90e8\u5206\uff0c\u6211\u4ee5\u4e00\u79cd\u597d\u73a9\u7684\u65b9\u5f0f\u6765\u6f14\u793a\u4e86 WSL\uff0c\u800c\u4e14\u8fd9\u662f\u4e00\u79cd\u548c\u5f00\u53d1\u8005\u4eec\u76f8\u5173\u7684\u65b9\u5f0f\u3002<\/p>\n

\u6211\u4e2a\u4eba\u60f3\u8981\u5c55\u793a\u4f7f\u7528 git \u548c\u4e00\u4e9b\u4f20\u7edf\u7684\u7ec8\u7aef\u5f00\u53d1\u5de5\u5177\uff0c\u6211\u5df2\u7ecf\u5199\u597d\u4e86 Bash \u7684\u6f14\u793a\u7a0b\u5e8f\uff0c\u5305\u62ec\u4e86\u8fd9\u4e9b\u57fa\u7840\u7684\u4e1c\u897f\uff08\u7528 Python \u548c Ruby \u5199\u7684\u201cHello World\u201d\uff09\uff0c\u4e0d\u8fc7\u6211\u8fd8\u662f\u60f3\u8981\u66f4\u6709\u51b2\u51fb\u529b\u4e00\u4e9b\u3002<\/p>\n

\u6211\u56de\u60f3\u8d77\u6211\u5728\u5927\u5b66\u7684\u65f6\u5149\uff0c\u90a3\u65f6\u6211\u4eec\u5728 Unix\uff08DEC Ultrix \u53ca SunOS\uff09\u548c VAX\/VMS \u4e4b\u95f4\u6298\u817e\uff0cUnix \u51e0\u4e4e\u5168\u662f\u547d\u4ee4\u884c\u73af\u5883\u3002\u5728\u6211\u4eec\u5b66\u6821\uff0c\u7edd\u5927\u591a\u6570\u4f7f\u7528\u56fe\u5f62\u5de5\u4f5c\u7ad9\u7684\u7528\u6237\u53ea\u662f\u4e3a\u4e86\u5728\u4e0d\u540c\u7684\u7a97\u53e3\u6253\u5f00\u591a\u4e2a\u7ec8\u7aef\u4f1a\u8bdd\u800c\u5df2\uff0c\u5f53\u7136\uff0c\u4f1a\u5728\u684c\u9762\u80cc\u666f\u653e\u4e0a\u4e00\u5f20\u8d85\u9177\u7684\u6708\u76f8\u56fe\u3002\u5927\u90e8\u5206\u5b66\u751f\u90fd\u662f\u4f7f\u7528 VT-220 \u7ec8\u7aef\u6765\u6253\u5f00\u4ed6\u4eec\u7684\u4f1a\u8bdd\uff08\u5b66\u6821\u79bb\u6ce2\u58eb\u987f\u4e0d\u8fdc\uff0c\u6240\u4ee5\u6211\u4eec\u6709\u5f88\u591a DEC \u8bbe\u5907\uff09\u3002<\/p>\n

\u90a3\u65f6\uff0c\u8ba1\u7b97\u673a\u7cfb\u7684\u5b66\u751f\u4eec\u4e3b\u8981\u73a9\u4e24\u5927\u6e38\u620f\uff1aMUD(\u4e3b\u8981\u662f lpMUD \u548c\u5f53\u65f6\u521a\u51fa\u7684DikuMUD)\u548cNetHack(\"https:\/\/en.wikipedia.org\/wiki\/NetHack\") \u548c\u5176\u5b83\u7684\u00a0Roguelikes(\"https:\/\/en.wikipedia.org\/wiki\/Roguelike\")\u7c7b\u6e38\u620f\u88ab\u89c6\u4e3a\u5386\u53f2\u4e0a\u6700\u6709\u5f71\u54cd\u529b\u7684\u6e38\u620f\u4e4b\u4e00\uff0c\u5b83\u4eec\u662f\u8bb8\u591a\u73b0\u5728\u6d41\u884c\u7684\u5730\u7262\u5192\u9669\u548c\u89d2\u8272\u626e\u6f14\u7c7b\u6e38\u620f\u7684\u9f3b\u7956\u3002<\/p>\n

NetHack \u6709\u5f88\u957f\u7684\u5386\u53f2\uff0c\u73b0\u5728\u7684\u5b83\u5305\u542b\u4e86\u6765\u81ea\u51e0\u5341\u5e74\u524d\u7684\u51e0\u5341\u4e07\u884c *nix \u4ee3\u7801\uff0c\u4ee5\u53ca\u540e\u6765\u8865\u5145\u7684\u4e00\u4e9b\u4ee3\u7801\u3002\u8be5\u6e38\u620f\u4f7f\u7528curses(\"https:\/\/en.wikipedia.org\/wiki\/Curses_(programming_library)\")\uff08\u53ca\u5176\u66ff\u4ee3\u54c1\uff09\u4f5c\u4e3a\u7ec8\u7aef\u4ea4\u4e92\u65b9\u5f0f\uff0c\u9700\u8981\u901a\u8fc7 lex\u3001\u00a0yacc\uff08\u6216 flex \u548c bison\uff09\u548c cc\uff08\u6216 gcc\uff09\uff0c\u4ee5\u53ca\u4e00\u5806\u5176\u5b83\u7684\u5f00\u53d1\u5de5\u5177\u6784\u5efa\u3002<\/p>\n

\u5b83\u662f\u7531 C \u8bed\u8a00\u7f16\u5199\u7684\uff0c\u5e76\u5305\u62ec\u4e86\u4e00\u4e9b\u7528Bourne shell\u7f16\u5199\u7684\u590d\u6742\u7684\u811a\u672c\u914d\u7f6e\u529f\u80fd\u3002\u6211\u89c9\u5f97\u5b83\u662f\u4e00\u4e2a\u4f53\u73b0 WSL \u548c Bash on Windows 10 \u7684\u5f00\u53d1\u8005\u80fd\u529b\u7684\u4e0d\u9519\u800c\u6709\u8da3\u7684\u65b9\u5f0f\u3002\u7531\u4e8e\u4f7f\u7528\u4e86 curses\uff08\u5728 Linux \u548c WSL \u4e2d\u662f libncurses \u5e93\uff09\uff0c\u5b83\u4e5f\u53ef\u4ee5\u7528\u6765\u5c55\u793a Windows 10 \u4e2d\u547d\u4ee4\u884c\u7a97\u53e3\u4e2d\u7684\u7ec8\u7aef\u6a21\u62df\u80fd\u529b\u3002<\/p>\n

\u4ee5\u524d\uff0c\u5728\u6211\u4eec\u7684\u5206\u65f6 Ultrix \u670d\u52a1\u5668\u4e0a\u4ece\u6e90\u4ee3\u7801\u6784\u5efa NetHack \u8981\u82b1\u8d39\u6389\u6211\u4eec\u5f88\u591a\u65f6\u95f4\uff0c\u800c\u73b0\u5728\u6211\u7684\u4e2a\u4eba\u8ba1\u7b97\u673a\u4e0a\u53ea\u9700\u8981\u51e0\u5206\u949f\u5c31\u53ef\u4ee5\u641e\u5b9a\u3002\u6211\u559c\u6b22\u8fd9\u79cd\u6280\u672f\u8fdb\u6b65\u3002\u5728 Linux \u6216 WSL \u4e0a\u914d\u7f6e\u548c\u7f16\u8bd1 NetHack \u6709\u5bb9\u6613\u548c\u590d\u6742\u4e24\u79cd\u65b9\u5f0f\u3002\u4e3a\u4e86\u8282\u7701\u65f6\u95f4\uff0c\u6211\u4eec\u4f1a\u4ee5\u5bb9\u6613\u7684\u65b9\u5f0f\u6765\u8fdb\u884c\u3002<\/p>\n

\u524d\u7f6e\u9700\u6c42<\/strong><\/div>\n

\u9996\u5148\uff0c\u66f4\u65b0\u4f60\u7684 WSL \u73af\u5883\uff0c\u786e\u4fdd\u4f60\u7684\u8f6f\u4ef6\u662f\u6700\u65b0\u7684\u3002\u5728\u5b89\u88c5\u65b0\u7684\u8f6f\u4ef6\u5305\u4e4b\u524d\uff0c\u8fd9\u662f\u4e00\u4e2a\u597d\u7684\u505a\u6cd5\u3002<\/p>\n

$ sudo apt update\r\n$ sudo apt upgrade<\/pre>\n

\u7136\u540e\uff0c\u5b89\u88c5\u5fc5\u987b\u7684\u5f00\u53d1\u5de5\u5177\u3002\u6700\u7b80\u5355\u7684\u529e\u6cd5\u5c31\u662f\u4f7f\u7528 build-essential \u8f6f\u4ef6\u5305\uff0c\u5b83\u5305\u62ec\u4e86 Linux \u5f00\u53d1\u8005\u6784\u5efa\u4ee5 C\/C++ \u5f00\u53d1\u7684\u8f6f\u4ef6\u65f6\u6240\u9700\u7684\u7edd\u5927\u90e8\u5206\u7a0b\u5e8f\u3002<\/p>\n

$ sudo apt install build-essential<\/pre>\n

\u8fd9\u8981\u82b1\u51e0\u5206\u949f\u3002\u5982\u679c\u4f60\u60f3\u66f4\u52a0\u6df1\u5165\u5730\u4e86\u89e3\uff0c\u4f60\u53ef\u4ee5\u5206\u522b\u5b89\u88c5 gcc\u3001gdb\u3001make\u3001flex\u3001bison \u4ee5\u53ca NetHack \u6587\u6863\u4e2d\u63d0\u5230\u7684\u5176\u5b83\u5de5\u5177\u3002\u4e0d\u8fc7\u5982\u679c\u4f60\u662f\u4e00\u4f4d\u5f00\u53d1\u8005\uff0c\u6709\u65f6\u5019\u4f60\u53ef\u80fd\u8fd8\u9700\u8981\u4e00\u4e9b\u5176\u5b83\u5de5\u5177\u3002\u00a0build-essential \u57fa\u672c\u4e0a\u63d0\u4f9b\u4e86\u4f60\u6240\u9700\u7684\u5de5\u5177\u96c6\u3002<\/p>\n

\u7136\u540e\uff0c\u5b89\u88c5 git\u3002\u5982\u4f60\u6240\u60f3\uff0c\u5f88\u5bb9\u6613\uff1a<\/p>\n

$ sudo apt install git<\/pre>\n

\u5c31\u50cf\u5728 Linux \u4e2d\u4e00\u6837\uff0c\u4f60\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a git \u7684 PPA \u6765\u83b7\u53d6\u8f83\u65b0\u7684\u7248\u672c\uff0c\u4e0d\u8fc7\u8fd9\u91cc\u6211\u4eec\u6709\u4e00\u4e2a\u5c31\u884c\u4e86\u3002<\/p>\n

\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5 curses\uff08\u5b9e\u9645\u4e0a\u662f ncurses\uff09\u6765\u8fdb\u884c\u7ec8\u7aef\u5c4f\u5e55\u4ea4\u4e92\u3002<\/p>\n

$ sudo apt install libncurses-dev<\/pre>\n

\u5f53\u6211\u4eec\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u6784\u5efa NetHack \u4e86\u3002<\/p>\n

\u6784\u5efa NetHack<\/strong><\/div>\n

\u5b98\u65b9\u7684 NetHack \u4ed3\u5e93\u653e\u5728GitHub(\"https:\/\/github.com\/NetHack\/NetHack\")\u4e0a\uff0c\u9996\u5148\u6211\u4eec\u9700\u8981\u628a\u5b83\u6293\u53d6\u4e0b\u6765\u653e\u5230\u6211\u4eec\u7684\u4e3b\u76ee\u5f55\u91cc\u9762\u3002<\/p>\n

$ cd ~$ git clone http:\/\/github.com\/NetHack\/NetHack<\/pre>\n

\"\u73a9\u8f6c<\/p>\n

\u56e0\u4e3a NetHack \u652f\u6301\u5f88\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u505a\u4e00\u4e9b\u57fa\u7840\u914d\u7f6e\u6765\u544a\u8bc9\u5b83\u6211\u4eec\u4f7f\u7528\u7684\u662f Linux\uff0c\u5e76\u4e14\u7528\u5f00\u6e90\u7684 gcc \u4ee3\u66ff\u4e86\u4e86\u00a0Unix \u4e0a cc \u7684\u4f5c\u7528\u3002<\/p>\n

\u5982\u6211\u6240\u63d0\u5230\u7684\uff0c\u8fd9\u6709\u597d\u51e0\u79cd\u529e\u6cd5\u53ef\u4ee5\u5b9e\u73b0\u3002\u6709\u4e9b\u4eba\u60f3\u5f88\u5468\u5230\uff0c\u5c06\u8fd9\u4e9b\u914d\u7f6e\u4fe1\u606f\u653e\u5230\u4e86 hints \u6587\u4ef6\u4e2d\u3002\u76f8\u4fe1\u6211\uff0c\u4f7f\u7528 hints \u6587\u4ef6\u4f1a\u907f\u514d\u9047\u5230\u8be5 GitHub \u4ed3\u5e93\u4e2d\u63d0\u5230\u7684\u5f88\u591a\u9ebb\u70e6\u3002\u5728 README \u6587\u4ef6\u548c\u5176\u5b83\u6587\u6863\u4e2d\u5e76\u6ca1\u6709\u7740\u91cd\u63d0\u5230\u5982\u4f55\u4f7f\u7528 hints \u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n

$ cd NetHack\/sys\/unix\r\n$ .\/setup.sh hints\/linux<\/pre>\n

\u8fd9\u5c06\u4f1a\u8bbe\u7f6e Makefile \u6b63\u786e\u7684\u4f7f\u7528 Linux \u4e0b\u7684\u5de5\u5177\u3001\u5e93\u53ca\u5176\u8def\u5f84\u3002\u8fd9\u4e2a\u8bbe\u7f6e\u811a\u672c\u5f88\u5f3a\u5927\uff0c\u5b83\u505a\u4e86\u5927\u91cf\u7684\u914d\u7f6e\u5de5\u4f5c\uff0c\u5f88\u9ad8\u5174\u5b83\u5728 WSL \u4e2d\u5de5\u4f5c\u7684\u4e5f\u5f88\u597d\u3002\u5982\u679c\u4f60\u5f88\u597d\u5947\u8fd9\u4e2a\u811a\u672c\u662f\u5982\u4f55\u5199\u7684\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4f60\u7684\u7f16\u8f91\u5668\u6253\u5f00\u5b83\u4e00\u7aa5\u7a76\u7adf\u3002<\/p>\n

\u7136\u540e\uff0c\u5f00\u59cb\u6700\u7ec8\u7684\u6784\u5efa\uff1a<\/p>\n

$ cd ~\/NetHack\r\n$ make all<\/pre>\n

\u6784\u5efa\u5b8c\u6210\u4e4b\u540e\uff0c\u4f60\u9700\u8981\u5b89\u88c5\u5b83\u3002\u8fd9\u5176\u5b9e\u5c31\u662f\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u590d\u5236\u5230\u76ee\u6807\u4f4d\u7f6e\uff1a<\/p>\n

$ make install<\/pre>\n

\u5b83\u4f1a\u5b89\u88c5\u5230\u4f60\u7684\u00a0~\/nh \u6587\u4ef6\u5939\u4e0b\uff0c NetHack \u653e\u5728\u00a0~\/nh\/install\/games \u76ee\u5f55\uff0c\u540d\u4e3a nethack\u3002\u8981\u8fd0\u884c\u5b83\uff0c\u5207\u6362\u5230\u8be5\u76ee\u5f55\uff08\u6216\u8f93\u5165\u5b8c\u6574\u8def\u5f84\uff09\u5e76\u8f93\u5165\uff1a<\/p>\n

$ cd ~\/nh\/install\/games\r\n$ nethack<\/pre>\n

\u7136\u540e\uff0c\u5c4f\u5e55\u4f1a\u6e05\u5c4f\u5e76\u663e\u793a\u4f60\u53ef\u4ee5\u73a9 NetHack \u4e86\u3002\u6ce8\u610f\uff0c\u6240\u6709\u7684\u4e1c\u897f\u90fd\u662f\u5728\u8fd9\u4e2a Ubuntu Linux \u73af\u5883\u4e2d\u5b8c\u6210\u7684\uff0c\u6839\u672c\u4e0d\u9700\u8981\u4efb\u4f55 Windows \u7279\u6709\u7684\u4e1c\u897f\u3002<\/p>\n

\u73a9 NetHack<\/strong><\/div>\n

\u7531\u4e8e\u7ec8\u7aef\u6e38\u620f\u7684\u5c40\u9650\u6027\u548c NetHack \u7684\u590d\u6742\u6027\uff0c\u8fd9\u91cc\u53ea\u80fd\u4e00\u5e26\u800c\u8fc7\u3002\u5bf9\u4e8e\u521d\u6b21\u63a5\u89e6\u5b83\u7684\u4eba\u6765\u8bf4\uff0c\u8fd8\u6709\u4e00\u4e9b\u795e\u79d8\u7684\u5730\u65b9\uff0c\u4e0d\u8fc7\u6211\u89c9\u5f97\u6211\u4eec\u7a0b\u5e8f\u5458\u4eec\u4ece\u6765\u4e0d\u6015\u6311\u6218\u672a\u77e5\u3002<\/p>\n

\u65b9\u5411\u952e\u548c vi\uff08vim\uff09\u4e2d\u7684\u4e00\u6837\uff0cHJKL \u662f\u5de6\u3001\u4e0b\u3001\u4e0a\u3001\u53f3\u3002\u8981\u9000\u51fa\u6e38\u620f\uff0c\u4f60\u53ef\u4ee5\u5728\u5730\u4e0b\u57ce\u9876\u5c42\u627e\u5230\u697c\u68af\u51fa\u53e3\u7136\u540e\u4f7f\u7528\u5b83\u5c31\u53ef\u4ee5\uff0c\u6216\u8005\u76f4\u63a5\u6309\u4e0b CTRL-C \u5f3a\u5236\u9000\u51fa\u3002<\/p>\n

\u5728 NetHack \u4e2d\uff0c @ \u7b26\u53f7\u4ee3\u8868\u4f60\u81ea\u5df1\uff0c\u6bcf\u4e00\u5c42\u90fd\u7531\u623f\u95f4\u3001\u8d70\u5eca\u3001\u95e8\uff0c\u548c\u5411\u4e0a\u53ca\u5411\u4e0b\u7684\u697c\u68af\u7ec4\u6210\u3002\u602a\u7269\u3001\u5b9d\u7bb1\u548c\u7269\u54c1\u4ee5\u5404\u79cd ASCII \u00a0\u5b57\u7b26\u7ec4\u6210\uff0c\u4f60\u6162\u6162\u5c31\u4f1a\u719f\u6089\u5b83\u4eec\u3002\u4e3a\u4e86\u7b26\u5408\u00a0Roguelikes \u6e38\u620f\u89c4\u8303\uff0c\u5e76\u6ca1\u6709\u5b58\u76d8\u529f\u80fd\uff0c\u4f60\u53ea\u6709\u4e00\u6761\u547d\u3002\u5982\u679c\u4f60\u6b7b\u4e86\u5c31\u53ea\u80fd\u91cd\u73a9\uff0c\u5730\u4e0b\u57ce\u73af\u5883\u662f\u968f\u673a\u751f\u6210\u7684\uff0c\u5404\u79cd\u7269\u54c1\u4e5f\u662f\u6253\u4e71\u653e\u7f6e\u7684\u3002<\/p>\n

NetHack \u6e38\u620f\u7684\u76ee\u7684\u662f\u5728\u5730\u4e0b\u57ce\u751f\u5b58\uff0c\u6536\u96c6\u91d1\u5b50\u548c\u7269\u54c1\uff0c\u5c3d\u53ef\u80fd\u7684\u5e72\u6389\u5404\u79cd\u602a\u7269\u3002\u9664\u4e86\u8fd9\u4e9b\u76ee\u7684\u4e4b\u5916\uff0c\u4f60\u5c31\u662f\u4e0d\u65ad\u5728\u5176\u4e2d\u73a9\u6765\u627e\u5b83\u4eec\u3002\u89c4\u5219\u5927\u81f4\u9075\u5faa\u201c\u9f99\u4e0e\u5730\u4e0b\u57ce\uff08DnD\uff09\u201d\u7684\u6b66\u5668\u3001\u6280\u80fd\u7b49\u89c4\u5219\u3002<\/p>\n

\u4e0b\u9762\u7684 NetHack \u622a\u5c4f\u4e0a\u53ef\u4ee5\u770b\u5230\u6709\u4e09\u4e2a\u623f\u95f4\u548c\u4e24\u4e2a\u8d70\u5eca\u3002\u5411\u4e0a\u7684\u697c\u68af\u5728\u5de6\u4e0a\u89d2\u7684\u623f\u95f4\u91cc\uff0c\u6211\u73b0\u5728\u5728\u53f3\u4e0a\u89d2\u7684\u623f\u95f4\uff0c\u8fd8\u6709\u4e00\u4e9b\u5b9d\u7bb1\u548c\u5176\u5b83\u7269\u54c1\u3002<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u5982\u679c\u5728\u4f60\u7684\u6e38\u620f\u4e2d\u6ca1\u6709\u663e\u793a\u989c\u8272\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u00a0~\/.nethackrc \u7684\u6587\u4ef6\uff0c\u5e76\u653e\u5165\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n

OPTIONS=color:true,dark_room:true,menucolors:true<\/pre>\n

\u6ce8\uff1a\u5982\u679c ASCII \u5b57\u7b26\u56fe\u5f62\u4e0d\u662f\u4f60\u7684\u83dc\uff0c\u4f46\u662f\u4f60\u559c\u6b22\u8fd9\u79cd\u7c7b\u578b\u7684\u6e38\u620f\uff0c\u4f60\u53ef\u4ee5\u5728\u5fae\u8f6f\u5546\u5e97\u641c\u7d22\u201croguelike\u201d\u6765\u627e\u5230\u89c6\u89c9\u4e0a\u66f4\u597d\u770b\u7684\u8fd9\u79cd\u6e38\u620f\u3002<\/p>\n

\u5f53\u7136\uff0cNetHack \u5f88\u53e4\u8001\u4e86\uff0c\u53ef\u80fd\u53ea\u6709\u7279\u5b9a\u5e74\u9f84\u6bb5\u7684\u4eba\u4eec\u559c\u6b22\u5b83\u3002\u4e0d\u8fc7\uff0c\u6784\u5efa\u5b83\u7528\u5230\u4e86\u5927\u91cf\u91cd\u8981\u7684\u5f00\u53d1\u5de5\u5177\u548c *nix \u64cd\u4f5c\u7cfb\u7edf\u529f\u80fd\uff0c\u4e5f\u5305\u62ec\u7ec8\u7aef\u6a21\u62df\u529f\u80fd\u3002\u4ece\u8fd9\u91cc\u53ef\u4ee5\u770b\u5230\uff0c\u4ece gcc\u3001gdb\u3001make\u3001bison \u548c flex \u5230\u66f4\u73b0\u4ee3\u4e00\u4e9b\u7684 git\uff0c\u90fd\u5728 WSL \u91cc\u9762\u5de5\u4f5c\u7684\u5f88\u597d\u3002<\/p>\n

\u5982\u679c\u4f60\u60f3\u770b\u770b Build Tour \u5927\u4f1a\u4e0a\u7684\u6f14\u793a\uff0c\u4f60\u53ef\u4ee5\u5728 Build Tour \u52a0\u62ff\u5927\u5927\u4f1a\u4e0a\u770b\u5230\u8fd9\u4e2a\u8bb2\u6f14\u3002WSL \u7684\u8fd9\u90e8\u5206\u6f14\u793a\u5728 6:20 \u5f00\u59cb\u3002<\/p>\n

\u5e0c\u671b\u4f60\u80fd\u559c\u6b22\u5728 NetHack \u5730\u4e0b\u57ce\u4e2d\u7684\u63a2\u9669\u3002<\/p>\n

C \u548c C++ \u90fd\u5f88\u4f1f\u5927\uff0c\u5c31\u50cf\u5176\u4ed6\u7684\u90a3\u4e9b\u7ecf\u5178\u7684\u5f00\u53d1\u5de5\u5177\u4e00\u6837\u3002\u4f60\u751a\u81f3\u8fd8\u53ef\u4ee5\u7528\u666e\u901a\u7684 Bash \u811a\u672c\u505a\u5230\u5f88\u591a\u3002\u4e0d\u8fc7\uff0c\u4e5f\u6709\u5f88\u591a\u5f00\u53d1\u8005\u559c\u6b22\u7528 Python \u505a\u4e3a\u4ed6\u4eec\u7684\u811a\u672c\u8bed\u8a00\u3002<\/p>\n

Python<\/strong><\/div>\n

\u4f60\u53ef\u4ee5\u5728\u7f51\u4e0a\u627e\u5230\u5f88\u591a Python \u811a\u672c\u7684\u4f8b\u5b50\uff0c\u8fd9\u610f\u5473\u7740 Python \u8d8a\u6765\u8d8a\u6d41\u884c\uff0c\u4e5f\u8d8a\u6765\u8d8a\u6709\u7528\u4e86\u3002\u5f53\u7136\uff0c\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u8fd9\u4e9b\u4f8b\u5b50\u90fd\u662f\u8fd0\u884c\u5728 Linux \u4e0b\u7684\u3002\u5728\u8fc7\u53bb\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u6709\u53e6\u5916\u4e00\u53f0\u5b89\u88c5\u7740 Linux \u7684\u673a\u5668\u6765\u8fd0\u884c\u5b83\u4eec\uff0c\u6216\u8005\u4f7f\u7528\u865a\u62df\u673a\u548c\u591a\u5f15\u5bfc\uff0c\u5426\u5219\u5c31\u9700\u8981\u4fee\u6539\u4e00\u4e9b\u4e1c\u897f\u624d\u80fd\u8ba9\u4ed6\u4eec\u8fd0\u884c\u5728 Windows \u4e0b\u7684\u00a0Python \u73af\u5883\u4e2d\u3002<\/p>\n

\u8fd9\u662f\u90fd\u4e0d\u662f\u65e0\u6cd5\u89e3\u51b3\u7684\u95ee\u9898\uff0c\u4f46\u662f\u5b83\u4f1a\u65e5\u6e10\u6d88\u78e8\u5f00\u53d1\u4eba\u5458\u6bcf\u5929\u7684\u751f\u6d3b\u3002\u901a\u8fc7 WSL\uff0c\u4e0d\u7528\u6298\u817e\u4f60\u5c31\u62e5\u6709\u4e86\u4e00\u4e2a\u517c\u5bb9\u7684\u3001\u5177\u6709 Python \u529f\u80fd\u548c shell \u53d8\u91cf\u7684\u5b50\u7cfb\u7edf\u3002<\/p>\n

\u8981\u5b89\u88c5\u6700\u65b0\u7684 Python \u5f00\u53d1\u7248\u672c\u548c Python \u5305\u5b89\u88c5\u5668 pip\uff0c\u5728 Bash \u4e2d\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n

$ sudo apt install python-pip python-dev\r\n$ sudo pip install --upgrade pip<\/pre>\n

\u73b0\u5728 Python \u5b89\u88c5\u597d\u4e86\uff0c\u6211\u8981\u5c55\u793a\u7ed9\u4f60\u5982\u4f55\u4ece\u7f51\u4e0a\u83b7\u53d6\u4e00\u4e2a\u5178\u578b\u7684 Linux \u4e0b\u7684 Python \u4f8b\u5b50\u5e76\u8ba9\u5b83\u76f4\u63a5\u5de5\u4f5c\u8d77\u6765\u3002\u6211\u53bbActivestate Python \u83dc\u8c31\u7ad9(\"http:\/\/code.activestate.com\/recipes\/langs\/python\/?query_start=1\")\u627e\u4e00\u4e2a\u6392\u540d\u7b2c\u4e00\u7684 Python \u4f8b\u5b50\u3002\u597d\u5427\uff0c\u6211\u8d70\u773c\u4e86\uff0c\u6392\u540d\u7b2c\u4e00\u7684\u662f\u6253\u5370\u51fa\u6574\u6570\u540d\u79f0\u7684\u811a\u672c\uff0c\u8fd9\u770b\u8d77\u6765\u6ca1\u5565\u610f\u601d\uff0c\u6240\u4ee5\u6211\u9009\u62e9\u4e86\u7b2c\u4e8c\u540d\uff1a\u4fc4\u7f57\u65af\u65b9\u5757\u3002\u6211\u4eec\u6bcf\u5929\u90fd\u80fd\u770b\u5230 Python \u51fa\u73b0\u5728\u5404\u79cd\u5730\u65b9\uff0c\u6240\u4ee5\u8fd9\u6b21\u8ba9\u6211\u4eec\u53bb\u73a9\u53e6\u5916\u4e00\u4e2a\u6e38\u620f\u3002<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u6211\u6253\u5f00\u4e86 nano \u7f16\u8f91\u5668\uff0c\u4ece Windows \u4e0a\u7684\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00\u7684\u9875\u9762\u4e0a\u590d\u5236\u4e86\u8fd9 275 \u884c Python \u4ee3\u7801\uff0c\u7136\u540e\u7c98\u8d34\u5230\u6211\u7684 WSL \u7ec8\u7aef\u7a97\u53e3\u7ec8\u7aef\u4e2d\u7684 nano \u4e2d\uff0c\u5e76\u4fdd\u5b58\u4e3a tetris.py \uff0c\u7136\u540e\u6267\u884c\u5b83\uff1a<\/p>\n

$ python tetris.py<\/pre>\n

\u5b83\u9a6c\u4e0a\u5c31\u6e05\u5c4f\u5e76\u51fa\u73b0\u4e86\u4fc4\u7f57\u65af\u65b9\u5757\u7684\u6e38\u620f\u3002\u540c NetHack \u4e00\u6837\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u540c\u6837\u7684 vi \u6807\u51c6\u7684\u65b9\u5411\u952e\u6765\u79fb\u52a8\uff08\u4ee5\u524d\u662f\u4f7f\u7528\u9f20\u6807\u548c WSAD \u952e\u6765\u79fb\u52a8\uff0c\u800c\u53f3\u624b\u4f7f\u7528 HJKL \u952e\u66f4\u65b9\u4fbf\uff09\u3002<\/p>\n

\"\u73a9\u8f6c<\/p>\n

\u5982\u6211\u6240\u63d0\u5230\u7684\uff0c\u4f60\u5f53\u7136\u53ef\u4ee5\u4e0d\u7528 WSL \u5c31\u5728 Windows \u4e2d\u8fd0\u884c Python\u3002\u7136\u800c\uff0c\u8981\u60f3\u5feb\u901f\u7b80\u4fbf\uff0c\u4e0d\u7528\u4fee\u6539 Linux \u4e0b\u7684 Python \u4ee3\u7801\uff0c\u53ea\u9700\u8981\u7b80\u5355\u7684\u590d\u5236\u7c98\u8d34\u4ee3\u7801\u5373\u53ef\u8fd0\u884c\uff0c\u5219\u53ef\u4ee5\u6781\u5927\u7684\u63d0\u9ad8\u5f00\u53d1\u8005\u7684\u6548\u7387\u3002<\/p>\n

\u8fd9\u662f\u771f\u7684\u3002\u8fd9\u5e76\u4e0d\u662f\u8981\u66ff\u4ee3 Windows \u539f\u751f\u7684\u5de5\u5177\uff0c\u6bd4\u5982 Python\u3001PowerShell\u3001C# \u7b49\u7b49\uff0c\u800c\u662f\u5f53\u4f60\u9700\u8981\u5728\u73b0\u4ee3\u7684\u5f00\u53d1\u5de5\u4f5c\u6d41\u7a0b\u4e2d\u5feb\u901f\u800c\u6709\u6548\u5730\u5b8c\u6210\u4e00\u4e9b\u4e8b\u60c5\u65f6\uff0c\u53ef\u4ee5\u907f\u514d\u79cd\u79cd\u6298\u817e\u3002<\/p>\n

\u5305\u62ec Bash\u3001Python \u4ee5\u53ca\u5176\u5b83\u6240\u6709\u7684 Linux \u539f\u751f\u7684\u547d\u4ee4\u884c\u5f00\u53d1\u5de5\u5177\uff0cWSL \u4e3a\u6211\u7684\u5f00\u53d1\u5de5\u4f5c\u63d0\u4f9b\u4e86\u6240\u6709\u9700\u8981\u7684\u5de5\u5177\u3002\u8fd9\u4e0d\u662f\u4e00\u4e2a Linux \u670d\u52a1\u5668\uff0c\u751a\u81f3\u4e5f\u4e0d\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u5ba2\u6237\u7aef\uff0c\u76f8\u53cd\uff0c\u5b83\u5c31\u662f\u4e00\u4e2a\u53ef\u4ee5\u8ba9\u6211\u907f\u514d\u6bcf\u5929\u6298\u817e\uff0c\u8ba9\u6211\u5728 Windows \u4e0a\u5f00\u53d1\u66f4\u6709\u6548\u7387\u3001\u66f4\u6709\u5feb\u611f\u7684\u4e00\u4e2a\u4e1c\u897f\uff01<\/p>\n

\u91cd\u7f6e\u4f60\u7684 WSL \u73af\u5883<\/strong><\/div>\n

\u968f\u4fbf\u53bb\u8bd5\u5427\uff0c\u5982\u679c\u4f60\u641e\u574f\u4e86\u4f60\u7684 WSL \u73af\u5883\uff0c\u5b83\u5f88\u5bb9\u6613\u91cd\u65b0\u5b89\u88c5\u3002\u5728\u8fdb\u884c\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u505a\u597d\u4e86\u4efb\u4f55\u91cd\u8981\u5185\u5bb9\u7684\u5907\u4efd\u3002<\/p>\n

C:\/> lxrun.exe \/uninstall \/full\r\nC:\/> lxrun.exe \/install<\/pre>\n
\u4f60\u4f7f\u7528 Bash \u548c WSL \u7684\u611f\u89c9\u5982\u4f55\uff1f<\/strong><\/div>\n

\u6211\u4eec\u5e0c\u671b WSL \uff0c\u7279\u522b\u662f Bash \u53ef\u4ee5\u5728 Windows 10 \u4e2d\u5e2e\u4f60\u5e26\u6765\u66f4\u9ad8\u7684\u6548\u7387\uff0c\u51cf\u5c11\u6bcf\u5929\u7684\u5f00\u53d1\u4e2d\u7684\u6298\u817e\u3002<\/p>\n

\u4f60\u5bf9 Windows 10 \u4e0a\u7684 WSL \u600e\u4e48\u770b\uff1f\u4f60\u559c\u6b22\u4f7f\u7528\u5b83\u5417\uff1f<\/p>\n

\u5f00\u53d1\u56e2\u961f\u505a\u4e86\u5927\u91cf\u7684\u5de5\u4f5c\u5e0c\u671b\u8ba9 WSL \u6210\u4e3a\u4e00\u4e2a\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u7684\u5f3a\u5927\u7684\u7ec8\u7aef\u5de5\u5177\u3002\u5982\u679c\u4f60\u6709\u4efb\u4f55\u53cd\u9988\u6216\u8fd0\u884c\u51fa\u73b0\u95ee\u9898\uff0c\u6211\u4eec\u63a8\u8350\u4f60\u67e5\u770b\u4e00\u4e0bGitHub \u53cd\u9988\u9875\u9762(\"https:\/\/github.com\/Microsoft\/BashOnWindows\/issues\")\uff0c\u4ee5\u53ca\u7528\u6237\u4e4b\u58f0\u7684\u53cd\u9988\u548c\u6295\u7968\u7ad9\u70b9(\"https:\/\/wpdev.uservoice.com\/forums\/266908-command-prompt-console-bash-on-ubuntu-on-windo)\u3002\u6211\u4eec\u771f\u7684\u5e0c\u671b\u542c\u5230\u4f60\u7684\u58f0\u97f3\u3002<\/p>\n

\u66f4\u591a\u53c2\u8003\u4e0e\u5ef6\u4f38\u9605\u8bfb<\/strong><\/div>\n

Linux shell \u7f16\u7a0b\u662f\u4e00\u4e2a\u5e9e\u5927\u7684\u8bdd\u9898\uff0c\u5728\u7f51\u4e0a\u6709\u5f88\u591a\u8fd9\u65b9\u9762\u7684\u5185\u5bb9\u3002\u5982\u679c\u4f60\u8fd8\u4e0d\u591f\u719f\u6089\u5b83\u4eec\uff0c\u60f3\u8981\u4e86\u89e3\u66f4\u591a\uff0c\u53ef\u4ee5\u770b\u770b\u5404\u79cd Bash \u6559\u7a0b\u3002(\"https:\/\/help.ubuntu.com\/community\/Beginners\/BashScripting\")\u3002<\/p>\n

\u8fd8\u6709\u4e00\u4e9b\u5176\u4ed6\u7684\u53c2\u8003\u8d44\u6599\u4e5f\u8bb8\u5bf9\u4f60\u6709\u7528\uff1a<\/p>\n