{"id":42,"date":"2024-03-10T16:14:19","date_gmt":"2024-03-10T08:14:19","guid":{"rendered":"https:\/\/www.cutegameit.com\/linux\/?p=27"},"modified":"2025-02-20T11:45:20","modified_gmt":"2025-02-20T03:45:20","slug":"linux-%e6%8c%87%e4%bb%a4-week-1","status":"publish","type":"post","link":"https:\/\/www.cutexyz.com\/edu\/linux2402\/?p=42","title":{"rendered":"Linux \u6307\u4ee4 Week 1"},"content":{"rendered":"\n<p>\u96d6\u7136\u8aaa Linux \u6709\u6240\u8b02\u7684\u684c\u9762\u7248, \u4ed6\u6709\u5716\u5f62\u4ecb\u9762\u53ef\u4ee5\u64cd\u4f5c, \u4f46\u662f\u5c0d\u65bc Linux \u7684\u6240\u6709\u7d30\u7bc0\u8abf\u6574\u8a2d\u5b9a, \u9084\u662f\u900f\u904e\u6587\u5b57\u4ecb\u9762( terminal ) \u7684\u65b9\u5f0f\u9032\u884c\u624d\u6703\u662f\u6700\u6709\u6548\u7387\u8207\u65b9\u4fbf\u7684, \u800c\u4e14\u4e0d\u540c\u7248\u672c\u7684 Linux \u5716\u5f62\u5316\u4ecb\u9762\u4e5f\u6703\u6709\u4e9b\u8a31\u7684\u4e0d\u540c, \u4f46\u5728\u6587\u5b57\u4ecb\u9762\u4e0b\u5c31\u4e0d\u5927\u6703\u6709\u6b64\u554f\u984c\u4e86!<br><br>\u800c\u5c31\u5982 Linux \u6703\u4ec0\u9ebc\u53ea\u8981\u6975\u4f4e\u7684\u786c\u9ad4\u914d\u5099\u5c31\u53ef\u4ee5\u57f7\u884c\u8a31\u591a\u7a0b\u5f0f\u8207\u63d0\u4f9b\u670d\u52d9, \u4e5f\u662f\u56e0\u70ba\u975e\u5716\u5f62\u4ecb\u9762\u4e0b, \u7cfb\u7d71\u7684\u8cc7\u6e90\u640d\u8017\u5c31\u5c11\u7684\u95dc\u4fc2!!  \u4e00\u53f0 Atom \u7684 eeebox \u67b6\u8a2d\u8d77\u4f86 Linux server \u53ef\u4ee5\u8dd1\u7684\u670d\u52d9\u9084\u662f\u975e\u5e38\u7684\u9806\u66a2!!! \u4e0b\u65b9\u6211\u5011\u5c31\u5217\u51fa\u672c\u9031\u6703\u63d0\u5230\u7684\u4e00\u4e9b\u6307\u4ee4, \u96d6\u7136<br>\u8aac Linux \u7684\u6307\u4ee4\u5f88\u591a, \u8981\u5168\u90e8\u5b78\u73a9\u597d\u50cf\u624d\u53eb\u5168\u61c2, \u4f46\u662f\u9019\u908a\u5efa\u8b70\u5404\u4f4d\u5b78\u7fd2\u8005, \u50c5\u9700\u719f\u8a18\u4e00\u4e9b\u5e38\u7528\u7684, \u5269\u4e0b\u4e0d\u5e38\u7528\u7684\u53ea\u8981\u5728\u9700\u8981\u6642, \u6253\u958b Google \u6536\u5c0b\u4e00\u4e0b\u5373\u53ef!!<\/p>\n\n\n\n<p><strong>\u90a3\u9ebc\u6211\u5011\u5c31\u958b\u59cb\u5427;<\/strong><\/p>\n\n\n\n<p class=\"has-contrast-color has-text-color\">\u25cf <strong>W 1-1<\/strong>,  <strong><mark style=\"color:#fb0000\" class=\"has-inline-color\">whoami<\/mark><\/strong><br>\u986f\u793a\u76ee\u524d\u4f7f\u7528\u8005 \u5e33\u865fid, \u4e0d\u904e\u9019\u6709\u9ede\u5ee2\u8a71, \u56e0\u70ba\u4f60\u5728\u8f38\u5165\u6307\u4ee4\u7684\u7576\u4e0b, \u901a\u5e38\u90fd\u6703\u6709 userid@server_name \u7684\u547d\u4ee4\u63d0\u793a\u5b57\u5143\u5728\u6700\u5de6\u908a. \u7bc4\u4f8b\u5982\u4e0b<\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>Syntax<\/strong> \u8a9e\u6cd5\u7bc4\u4f8b:<br><img decoding=\"async\" class=\"wp-image-35\" style=\"width: 300px\" src=\"https:\/\/www.cutegameit.com\/linux\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-21-at-15.35.42.png\" alt=\"\"> &lt;= \u5716\u793a, \u4e0d\u53ef\u8907\u88fd\u8cbc\u4e0a!<\/p>\n\n\n\n<pre class=\"wp-block-code has-base-color has-contrast-background-color has-text-color has-background has-small-font-size\"><code> # whoami\n cute301<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">\u4e0a\u65b9\u7684\u5340\u584a\u6307\u4ee4\u662f\u53ef\u4ee5\u8907\u88fd\u8cbc\u4e0a\u7684!!!  \u4e4b\u5f8c\u7684\u7bc4\u4f8b\u4e5f\u90fd\u6703\u662f\u9019\u6a23, \u5982\u5404\u4f4d\u9700\u8981\u8907\u88fd\u6307\u4ee4\u5c31\u9019\u5f9e\u9019\u908a\u8907\u88fd\u8cbc\u4e0a\u57f7\u884c. \u7b2c\u4e00\u884c\u5c31\u662f<strong>\u6307\u4ee4<\/strong>( # \u4e4b\u985e\u7684\u5b57\u5143), \u7b2c\u4e8c\u884c\u5247\u662f<strong>\u7cfb\u7d71\u56de\u61c9\u8f38\u51fa<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p>\u25cf <strong>W 1-2, <mark style=\"color:#fb0000\" class=\"has-inline-color\">exit<\/mark><\/strong><br>\u767b\u51fa\u96e2\u958b Linux \u7cfb\u7d71, \u985e\u4f3c logout, \u5728\u9019\u500b\u52d5\u4f5c\u4e4b\u5f8c\u9700\u8981\u518d\u6b21\u8f38\u5165\u5e33\u865f\u5bc6\u78bc\u624d\u80fd\u518d\u6b21\u64cd\u4f5c\u7cfb\u7d71. \u9019\u500b\u529f\u80fd\u770b\u4f3c\u7c21\u55ae, \u4f46\u662f\u597d\u6bd4\u8aaa MIS \u7b49\u8ddf\u8cc7\u5b89\u6709\u95dc\u7684\u5de5\u4f5c\u89d2\u8272, \u990a\u6210\u767b\u51fa\u7684\u597d\u7fd2\u6163\u662f\u5fc5\u9808\u6280\u80fd, \u56e0\u70ba\u5728\u96fb\u8166\u672a\u767b\u51fa\u7684\u60c5\u5f62\u4e0b\u96e2\u958b\u96fb\u8166\u53ef\u662f\u6709\u8457\u6975\u5927\u7684\u8cc7\u5b89\u98a8\u96aa\u554a !! \u4e0d\u53ef\u4e0d\u614e!!!<br><br><strong>Syntax<\/strong> \u8a9e\u6cd5\u7bc4\u4f8b:<br><img decoding=\"async\" class=\"wp-image-38\" style=\"width: 300px\" src=\"https:\/\/www.cutegameit.com\/linux\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-21-at-15.49.22.png\" alt=\"\"> &lt;= \u63a5\u4e0b\u4f86\u9664\u975e\u7279\u6b8a\u5fc5\u8981, \u624d\u6703\u8cbc\u4e0a!<\/p>\n\n\n\n<pre class=\"wp-block-code has-base-color has-contrast-background-color has-text-color has-background has-small-font-size\"><code> # exit\n logout<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p>\u25cf <strong>W 1-3, <mark style=\"color:#fb0000\" class=\"has-inline-color\">shutdown<\/mark><\/strong><br>\u9019\u500b\u6307\u4ee4\u662f\u7528\u5728\u95dc\u6a5f\u4e0a\u9762, \u4f46\u8981\u6ce8\u610f\u7684\u662f\u95dc\u6a5f\u6307\u4ee4\u662f\u53ef\u4ee5\u8207\u53c3\u6578\u7d44\u5408\u7684, \u8a73\u60c5\u8acb\u53c3\u8003\u4e0b\u65b9\u7bc4\u4f8b, \u53e6\u5916\u9019\u500b\u6307\u4ee4\u50c5\u9650 root \u9019\u985e\u64c1\u6709\u7ba1\u7406\u9019\u6b0a\u9650\u7684\u5e33\u865f\u57f7\u884c, \u5982\u679c\u4f60\u7684\u5e33\u865f\u975e root \u6b0a\u9650, \u4ed6\u5c31\u6703\u986f\u793a\u57f7\u884c\u5931\u6557!<br><br><strong>Syntax<\/strong> \u8a9e\u6cd5\u7bc4\u4f8b:<\/p>\n\n\n\n<pre class=\"wp-block-code has-base-color has-contrast-background-color has-text-color has-background has-small-font-size\"><code> # shutdown             &lt;==\u7cfb\u7d71\u5728\u5169\u5206\u9418\u5f8c\u95dc\u6a5f\uff0c\u4e26\u50b3\u9001\u8a0a\u606f\u7d66\u5728\u7dda\u4e0a\u7684\u4eba\n # shutdown  -h  now    &lt;==\u7cfb\u7d71\u7acb\u523b\u95dc\u6a5f\n # shutdown  -r  now    &lt;==\u7cfb\u7d71\u7acb\u523b\u91cd\u65b0\u958b\u6a5f\n # shutdown  -h  20:30  &lt;==\u7cfb\u7d71\u5728\u4eca\u5929\u7684 20:30 \u5206\u95dc\u6a5f\n # shutdown  -h  +10    &lt;==\u7cfb\u7d71\u5728 10 \u5206\u9418\u5f8c\u95dc\u6a5f<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p>\u25cf <strong>W 1-4, <mark style=\"color:#fb0000\" class=\"has-inline-color\">reboot<\/mark><\/strong><br>\u76f4\u63a5 Linux server \u91cd\u65b0\u555f\u52d5\u7684\u6307\u4ee4!!! \u9019\u7b97\u662f\u4e00\u500b\u5f88\u5e38\u4f7f\u7528\u7684\u6307\u4ee4, \u7576\u4f60\u505a\u4e86\u4e00\u4e9b\u7cfb\u7d71\u8a2d\u5b9a\u4e4b\u5f8c, \u70ba\u4e86\u8981\u78ba\u8a8d server \u5728\u91cd\u65b0\u555f\u52d5\u4e4b\u5f8c\u662f\u5426\u53ef\u4ee5\u6b63\u5e38\u904b\u4f5c\u6216\u662f\u81ea\u52d5\u57f7\u884c\u4e00\u4e9b\u670d\u52d9, \u5c31\u53ef\u4ee5\u8a66\u8457\u91cd\u65b0\u555f\u52d5\u7cfb\u7d71\u4ee5\u4fbf\u78ba\u8a8d\u4e4b. \u540c\u6a23\u7684, \u9019\u500b\u7cfb\u7d71\u91cd\u555f\u7684\u6307\u4ee4\u4e5f\u50c5\u9650\u6709 root \u6b0a\u9650\u7684\u5e33\u865f\u4f7f\u7528\u5594!!!<br> <br><strong>Syntax<\/strong> \u8a9e\u6cd5\u7bc4\u4f8b:<\/p>\n\n\n\n<pre class=\"wp-block-code has-base-color has-contrast-background-color has-text-color has-background has-small-font-size\"><code> # reboot\nConnection to 127.0.0.1 closed by remote host.<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p>\u25cf <strong>W 1-5, <mark style=\"color:#fb0000\" class=\"has-inline-color\">ps aux<\/mark><\/strong><br>\u9019\u662f\u5bdf\u770b\u57f7\u884c\u4e2d\u7684\u7a0b\u5f0f\u7684\u4e00\u500b\u6307\u4ee4, \u4f60\u53ef\u4ee5\u914d\u5408\u5176\u53c3\u6578 aux \u4f86\u57f7\u884c, \u9019\u500b\u6307\u4ee4\u662f\u7528\u4f86\u67e5\u770b\u7cfb\u7d71\u4e2d\u7684\u57f7\u884c\u7a0b\u5f0f, \u900f\u904e aux \u53ef\u4ee5\u986f\u793a\u6bcf\u4e00\u500b\u57f7\u884c\u7dd2(\u57f7\u884c\u7a0b\u5f0f)\u7684 pid, \u900f\u904e\u9019\u500b id \u5c31\u53ef\u4ee5\u5728\u7cfb\u7d71\u4e2d\u53bb\u7d42\u6b62\u67d0\u500b\u57f7\u884c\u7a0b\u5f0f\u7684\u904b\u884c( \u642d\u914d kill \u7684\u6307\u4ee4 ). <br> <br><strong>Syntax<\/strong> \u8a9e\u6cd5\u7bc4\u4f8b:<\/p>\n\n\n\n<pre class=\"wp-block-code has-base-color has-contrast-background-color has-text-color has-background has-small-font-size\"><code> # ps aux\nroot  2123  0.0  0.0      0 0 ?  I  17:28   0:00 &#091;kworker\/1:1]\nroot  2173  0.0  0.0      0 0 ?  I    17:33   0:00 &#091;kworker\/0:1]\nroot  2217  0.0  0.0      0 0 ?  I    17:38   0:00 &#091;kworker\/0:0]\nroot  2253  0.3  0.2   9540  4328 pts\/0  S  17:42  0:00 sudo su -\nroot  2255  0.3  0.1   8964  3892 pts\/0  S  17:42   0:00 su -\nroot  2256  2.5  0.2   6928  4312 pts\/0  S  17:42   0:00 -su\nroot  2270  0.0  0.1   7804  3316 pts\/0  R+ 17:43   0:00 ps -aux<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p>\u25cf <strong>W 1-6,<\/strong> <strong><mark style=\"color:#ff0000\" class=\"has-inline-color\">kill<\/mark><\/strong><br>\u7576\u4f60\u6709\u67d0\u500b\u57f7\u884c\u7a0b\u5f0f\u7684 pid, \u5c31\u53ef\u4ee5\u900f\u904e\u9019\u500b\u6307\u4ee4\u5c07\u5176\u7d42\u6b62\u6389, \u6703\u4f7f\u7528\u9019\u500b\u66b4\u529b\u529f\u80fd, \u5927\u591a\u662f\u60c5\u6cc1\u662f\u670d\u52d9\u5df2\u7d93\u7576\u6389\u4e86, \u624d\u6703\u9019\u6a23\u505a, \u5982\u679c\u662f\u639b\u5728\u65bc\u7cfb\u7d71\u5167\u7684 service, \u597d\u6bd4\u8aaa apache, nginx, db. \u4e4b\u985e\u7684, \u6211\u5011\u5247\u6703\u4f7f\u7528\u670d\u52d9\u7d42\u6b62\u7684\u65b9\u5f0f\u9032\u884c\u4e4b(\u4e4b\u5f8c\u63d0\u5230\u639b\u8f09\u7121\u8aa4\u5be6\u518d\u505a\u8aaa\u660e). \u4ee5\u4e0b\u5c31\u4ee5 pid \u7de8\u865f 1234 \u4f86\u793a\u7bc4.<br><br><strong>Syntax<\/strong> \u8a9e\u6cd5\u7bc4\u4f8b:<\/p>\n\n\n\n<pre class=\"wp-block-code has-base-color has-contrast-background-color has-text-color has-background has-small-font-size\"><code> # kill 1234\n #<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linux \u57fa\u672c\u6307\u4ee4 (1\/2)<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"disable_featured_image":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=42"}],"version-history":[{"count":1,"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":43,"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions\/43"}],"wp:attachment":[{"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cutexyz.com\/edu\/linux2402\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}