{"id":17123,"date":"2024-01-07T20:20:17","date_gmt":"2024-01-07T12:20:17","guid":{"rendered":"https:\/\/www.linuxcool.com\/lcysmlgsqlml"},"modified":"2024-01-07T20:20:17","modified_gmt":"2024-01-07T12:20:17","slug":"lcysmlgsqlml","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/lcysmlgsqlml","title":{"rendered":"linux\u5e38\u7528shell\u547d\u4ee4 4\u4e2a\u795e\u5947Linux\u547d\u4ee4\uff0c\u8ba9\u4f60\u5de5\u4f5c\u6548\u7387\u98de\u901f\u63d0\u5347"},"content":{"rendered":"<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5728\u6211\u4eec\u7684\u65e5\u5e38\u5b66\u4e60\u548c\u751f\u6d3b\u8fc7\u7a0b\u4e2d\uff0c\u6bcf\u65e5\u90fd\u9700\u9891\u7e41\u5730\u63a5\u89e6\u5230<a style='color:#0000CC' href='https:\/\/www.linuxprobe.com\/' target='_blank' rel=\"noopener\">Linux<\/a><a style='color:#0000CC' href='https:\/\/www.linuxdown.com\/' target='_blank' rel=\"noopener\">\u7cfb\u7edf<\/a>\u4e2d\u6240\u5305\u542b\u7684Shell<a style='color:#0000CC' href='https:\/\/www.linuxcool.com\/' target='_blank' rel=\"noopener\">\u547d\u4ee4<\/a>\u3002\u719f\u7ec3\u638c\u63e1\u5e76\u8fd0\u7528\u8fd9\u4e9b\u547d\u4ee4\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u63d0\u5347\u6211\u4eec\u7684\u5de5\u4f5c\u6548\u7387\uff0c\u66f4\u6709\u52a9\u4e8e\u6df1\u5165\u4e86\u89e3\u7406\u89e3Linux\u7cfb\u7edf\u7684\u65b9\u65b9\u9762\u9762\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u4f1a\u4e3a\u60a8\u4f9d\u6b21\u4ecb\u7ecd\u51e0\u79cd\u5e38\u89c1\u7684Linux Shell\u6307\u4ee4\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>1. ls -\u5217\u51fa\u76ee\u5f55\u5185\u5bb9<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u53ea\u9700\u7b80\u5355\u5730\u8f93\u5165&#8221;ls&#8221;\u547d\u4ee4\uff0c\u5373\u53ef\u8fc5\u901f\u4e86\u89e3\u5f53\u4e0b\u5de5\u4f5c\u73af\u5883\u4e0b\u7684\u6587\u4ef6\u4e0e\u5b50\u76ee\u5f55\u4fe1\u606f\u3002\u8fd9\u662f\u4e2a\u65b9\u4fbf\u5b9e\u7528\u7684\u5c0f\u6280\u5de7\u54e6\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7acb\u5373\u83b7\u53d6\u5f53\u524d\u8def\u5f84\u4e0b\u5404\u7c7b\u6709\u6548\u6587\u4ef6\u4e0e\u5b50\u76ee\u5f55\u7684\u8be6\u7ec6\u62a5\u8868\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>2. cd -\u5207\u6362\u76ee\u5f55<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6e29\u99a8\u63d0\u793a\uff1a\u82e5\u8981\u66f4\u6539\u5f53\u524d\u7684\u5de5\u4f5c\u8def\u5f84\uff0c\u4e0d\u59a8\u8bd5\u8bd5\u4f7f\u7528\u201ccd\u201d\u547d\u4ee4\u54e6~\u4f8b\u5982\u8f93\u5165&#8221;cd \/home&#8221;\u4fbf\u53ef\u76f4\u8fbe\u6839\u76ee\u5f55\u4e0b\u7684&#8221;\/home&#8221;\u5b50\u76ee\u5f55\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>3. mkdir -\u521b\u5efa\u76ee\u5f55<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u53ea\u9700\u7b80\u5355\u8fd0\u7528mkdir\u547d\u4ee4\uff0c\u5c31\u80fd\u7acb\u523b\u62e5\u6709\u65b0\u6587\u4ef6\u5939\u54e6~\u53ea\u9700\u8981\u6572\u5165 mkdir new_folderlinux\u7cfb\u7edf\u88c5win7\uff0c\u90a3\u4e48\u5f53\u524d\u8def\u5f84\u4e0b\u65b9\u5c31\u4f1a\u81ea\u52a8\u751f\u6210\u4e00\u4e2a\u540d\u79f0\u4e3anew_folder\u7684\u6587\u4ef6\u5939\u4e86\uff0c\u662f\u4e0d\u662f\u975e\u5e38\u65b9\u4fbf\u5feb\u6377\u5462\uff1f<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>4. rm -\u5220\u9664\u6587\u4ef6\u6216\u76ee\u5f55<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u82e5\u60f3\u8f7b\u677e\u79fb\u9664\u6587\u4ef6\u6216\u7a7a\u76ee\u5f55\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528 rm \u547d\u4ee4\u6765\u5b8c\u6210\u54e6\uff01\u5982\u60f3\u5220\u9664\u540d\u4e3a file.txt \u7684\u6587\u4ef6\uff0c\u53ea\u9700\u8f93\u5165&#8221;rm file.txt&#8221;\u4fbf\u53ef\uff1b\u82e5\u8981\u6e05\u7406\u7a7a\u7684\u540d\u4e3a folder \u7684\u76ee\u5f55\uff0c\u53ea\u9700\u8f93\u5165&#8221;rm -r folder&#8221;\u5373\u53ef\uff0c\u653e\u5fc3\uff0c\u7edd\u5bf9\u65e0\u6b8b\u7559\u5594\uff5e<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>5. cp -\u590d\u5236\u6587\u4ef6\u6216\u76ee\u5f55<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:350px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2024\/01\/1704630016843_1.png' alt='\u5e38\u7528\u547d\u4ee4\u63d0\u793a\u7b26_linux\u5e38\u7528shell\u547d\u4ee4_\u5e38\u7528\u547d\u4ee4\u63d0\u793a\u7b26\u5927\u5168' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4f17\u6240\u5468\u77e5\uff0ccp\u547d\u4ee4\u662f\u6211\u4eec\u5e38\u7528\u7684\u5feb\u901f\u8f6c\u79fb\u6587\u4ef6\u4e0e\u76ee\u5f55\u7684\u5de5\u5177\u3002\u82e5\u4f60\u60f3\u4ecefile.txt\u8fc1\u79fb\u81f3new_file.txtlinux\u8f6f\u4ef6\u5de5\u7a0b\u5e08\u57f9\u8bad\uff0c\u7b80\u5355\u5730\u8f93\u5165cp file.txt new_file.txt\u5373\u53ef\u5b9e\u73b0\u3002\u5982\u679c\u9700\u8981\u62f7\u8d1d\u6574\u4e2a\u5b50\u8def\u5f84\uff0c\u6bd4\u5982folder\uff0c\u53ea\u9700\u8f93\u5165cp -r folder new_folder\uff0c\u5176\u4e2d\u201c-r\u201d\u8868\u793a\u9012\u5f52\u590d\u5236\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\uff0c\u4fbf\u53ef\u4ee5\u8f7b\u677e\u83b7\u53d6\u60f3\u8981\u7684\u7ed3\u679c\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>6. mv -\u79fb\u52a8\u6587\u4ef6\u6216\u76ee\u5f55<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>MV \u547d\u4ee4\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u7b80\u4fbf\u7684\u65b9\u5f0f\u6765\u8fdb\u884c\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u79fb\u52a8\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u53ea\u9700\u8f93\u5165&#8221;mv file.txt new_folder\/file.txt&#8221;\u4fbf\u53ef\u987a\u5229\u5730\u5c06&#8217;file.txt&#8217;\u6587\u4ef6\u79fb\u81f3&#8217;new_folder&#8217;\u76ee\u5f55\u5185\uff1b\u800c\u8981\u5c06\u6574\u4e2a&#8217;folder&#8217;\u76ee\u5f55\u642c\u8fc1\u81f3&#8217;new_folder&#8217;\uff0c\u540c\u6837\u53ea\u9700\u7b80\u5355\u7684&#8221;mv folder new_folder&#8221;\u6307\u4ee4\u4fbf\u53ef\u8fbe\u6210\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>7. cat -\u67e5\u770b\u6587\u4ef6\u5185\u5bb9<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u53ea\u9700\u8981\u8f7b\u8f7b\u6572\u4e0b&#8217;cat&#8217;\u8fd9\u4e2a\u7b80\u5355\u7684\u5feb\u6377\u952e<strong>linux\u5e38\u7528shell\u547d\u4ee4<\/strong>\uff0c\u5c31\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u9605\u6587\u4ef6\u5185\u5bb9\u54e6\u3002\u60a8\u53ea\u9700\u5728\u7ec8\u7aef\u8f93\u5165\u547d\u4ee4`cat file.txt`\uff0c\u5c31\u80fd\u9a6c\u4e0a\u770b\u5230&#8217;file.txt&#8217;\u8fd9\u4e2a\u6587\u6863\u91cc\u7684\u5168\u90e8\u6587\u5b57\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>8. grep -\u67e5\u627e\u6587\u4ef6\u4e2d\u7684\u5173\u952e\u8bcd<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd0\u7528\u6211\u4eec\u5e38\u7528\u7684grep\u547d\u4ee4\uff0c\u53ef\u65b9\u4fbf\u5730\u68c0\u7d22\u7279\u5b9a\u5173\u952e\u5b57\u5728\u7279\u5b9a\u6587\u4ef6\u4e2d\u7684\u51fa\u955c\u4f4d\u7f6e\u53ca\u9891\u7387\u3002\u4f8b\u5982\uff0c\u4ec5\u9700\u952e\u5165\u6307\u4ee4&#8221;grep &#8220;\u6211\u7684\u5173\u952e\u8bcd&#8221; myfile.ext&#8221;\uff0c\u4fbf\u80fd\u8fc5\u901f\u627e\u5230\u5e76\u5c55\u793amyfile.ext\u4e2d\u5305\u542b\u6709&#8221;\u6211\u7684\u5173\u952e\u8bcd&#8221;\u7684\u6240\u6709\u884c\u4fe1\u606f\u5566\uff01<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5b66\u4e60\u5e76\u719f\u7ec3\u638c\u63e1Linux Shell\u6307\u4ee4\uff0c\u80fd\u591f\u8ba9\u60a8\u66f4\u52a0\u8f7b\u677e\u81ea\u5982\u5730\u4eab\u53d7\u5230Linux\u7cfb\u7edf\u6240\u63d0\u4f9b\u7684\u4fbf\u6377\u670d\u52a1\uff0c\u4ece\u800c\u6709\u6548\u5730\u63a7\u5236\u4e0e\u7ba1\u7406\u7535\u8111\u4e0a\u7684\u5404\u7c7b\u6587\u4ef6\u548c\u76ee\u5f55\u3002\u5b9e\u9645\u4e0a<strong>linux\u5e38\u7528shell\u547d\u4ee4<\/strong>\uff0c\u8fd9\u5957\u5de5\u5177\u6240\u8574\u542b\u7684\u529f\u80fd\u8fdc\u4e0d\u6b62\u4e8e\u6b64\uff0c\u66f4\u591a\u5b9e\u7528\u7684\u547d\u4ee4\u7b49\u5f85\u7740\u60a8\u53bb\u53d1\u73b0\u548c\u5b66\u4e60\u3002\u6211\u4eec\u671f\u5f85\u901a\u8fc7\u8fd9\u6b21\u5206\u4eab\u5e2e\u52a9\u5927\u5bb6\u5bf9Linux Shell\u6709\u4e00\u4e2a\u57fa\u7840\u6027\u7684\u7406\u89e3\uff0c\u540c\u6837\u4e5f\u70ed\u70c8\u6b22\u8fce\u60a8\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u9010\u6e10\u63d0\u5347\u4e2a\u4eba\u7684\u6280\u672f\u6c34\u5e73\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6b64\u6587\u65e8\u5728\u7b80\u8981\u4ecb\u7ecdLinux shell \u4e2d\u5e38\u89c1\u7684\u51e0\u4e2a\u6307\u4ee4\uff0c\u5982ls(\u663e\u793a\u6587\u4ef6)\u3001cd(\u5207\u6362\u8def\u5f84)\u3001mkdir(\u65b0\u5efa\u76ee\u5f55)\u3001rm(\u5220\u9664\u6587\u4ef6)\u3001cp(\u62f7\u8d1d\u6587\u4ef6)\u4ee5\u53ca mv (\u79fb\u52a8\u53ca\u91cd\u547d\u540d\u6587\u4ef6)\u3002\u540c\u65f6\u8fd8\u6709 cat \u548cgrep \u8fd9\u6837\u7684\u5b9e\u7528\u5de5\u5177\uff0c\u7528\u4ee5\u67e5\u770b\u6587\u672c\u6587\u4ef6\u7684\u5185\u5bb9\u5e76\u641c\u7d22\u6307\u5b9a\u7684\u5b57\u7b26\u4e32\u3002\u638c\u63e1\u8fd9\u4e9b\u4e30\u5bcc\u800c\u5b9e\u7528\u7684\u6307\u4ee4\u5c06\u4f7f\u60a8\u5728 Linux \u7684\u4f7f\u7528\u4e2d\u66f4\u52a0\u5f97\u5fc3\u5e94\u624b\uff0c\u53ef\u66f4\u6df1\u5165\u7406\u89e3\u64cd\u4f5c\u7cfb\u7edf\u7684\u5185\u5728\u8fd0\u4f5c\u8fc7\u7a0b\u3002\u5e0c\u671b\u6211\u4eec\u7684\u5206\u4eab\uff0c\u80fd\u4e3a\u9605\u8bfb\u8005\u63d0\u4f9b\u4e9b\u8bb8\u4fbf\u5229\uff0c\u4e5f\u671f\u5f85\u60a8\u5206\u4eab\u66f4\u591a\u7684\u4f7f\u7528\u5fc3\u5f97\u4e0e\u6280\u5de7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u719f\u7ec3\u638c\u63e1\u5e76\u8fd0\u7528\u8fd9\u4e9b\u547d\u4ee4\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u63d0\u5347\u6211\u4eec\u7684\u5de5\u4f5c\u6548\u7387\uff0c\u66f4\u6709\u52a9\u4e8e\u6df1\u5165\u4e86\u89e3\u7406\u89e3Linux\u7cfb\u7edf\u7684\u65b9\u65b9\u9762\u9762\u3002\u53ea\u9700\u7b80\u5355\u8fd0\u7528mkdir\u547d\u4ee4\uff0c\u5c31\u80fd\u7acb\u523b\u62e5\u6709\u65b0\u6587\u4ef6\u5939\u54e6~\u547d\u4ee4\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u7b80\u4fbf\u7684\u65b9\u5f0f\u6765\u8fdb\u884c\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u79fb\u52a8\u64cd\u4f5c\u3002\u8fd0\u7528\u6211\u4eec\u5e38\u7528\u7684grep\u547d\u4ee4\uff0c\u53ef\u65b9\u4fbf\u5730\u68c0\u7d22\u7279\u5b9a\u5173\u952e\u5b57\u5728\u7279\u5b9a\u6587\u4ef6\u4e2d\u7684\u51fa\u955c\u4f4d\u7f6e\u53ca\u9891\u7387\u3002<\/p>\n","protected":false},"author":1,"featured_media":17124,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[44,23,46,27],"class_list":["post-17123","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge","tag-lcjwjj","tag-lxt","tag-s-2","tag-wjml"],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/17123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=17123"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/17123\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media\/17124"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=17123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=17123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=17123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}