{"id":19368,"date":"2022-12-06T17:27:39","date_gmt":"2022-12-06T09:27:39","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=19368"},"modified":"2022-12-06T17:28:43","modified_gmt":"2022-12-06T09:28:43","slug":"10-linux-commands","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/10-linux-commands.html","title":{"rendered":"Linux\u65b0\u624b\u5e94\u638c\u63e1\u768410\u4e2a\u57fa\u672c\u547d\u4ee4"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nLinux\u5bf9\u6211\u4eec\u7684\u751f\u6d3b\u6709\u7740\u5f88\u5927\u7684\u5f71\u54cd\u3002\u7136\u800c\u5728Linux\u4e0a\uff0c\u4f60\u901a\u5e38\u5e94\u8be5\u4f7f\u7528\u7ec8\u7aef\u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u53ea\u8981\u70b9\u51fb\u542f\u52a8\u5668\u56fe\u50cf(\u5c31\u50cf\u4f60\u5728Windows\u4e0a\u64cd\u4f5c\u90a3\u6837)\u3002\u8fd910\u4e2a\u57fa\u672c\u7684Linux\u547d\u4ee4\u548c\u91cd\u8981\u547d\u4ee4\u4f1a\u5e2e\u52a9\u4f60\u5c3d\u5feb\u5165\u95e8\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"000\"<\/p>\n

\u6211\u4eec\u5728\u8c08\u8bbaLinux\u547d\u4ee4\u65f6\uff0c\u5176\u5b9e\u662f\u5728\u8c08\u8bbaLinux\u7cfb\u7edf\u672c\u8eab\u3002\u5c31\u8fd9\u4e48\u533a\u533a10\u4e2a\u57fa\u672c\u7684Linux\u547d\u4ee4\u4e0d\u4f1a\u8ba9\u4f60\u6210\u4e3a\u5929\u624d\u6216Linux\u4e13\u5bb6\u3002\u5b83\u4f1a\u5e2e\u52a9Linux\u65b0\u624b\u4f7f\u7528\u8fd9\u4e9bLinux\u57fa\u672c\u547d\u4ee4\u6216\u8005\u8bf4Linux\u5e38\u7528\u547d\u4ee4\u6765\u5904\u7406\u65e5\u5e38\u7684\u57fa\u672c\u4efb\u52a1\u3002<\/p>\n

\u597d\u4e86\uff0c\u4e0b\u9762\u4e0d\u59a8\u9010\u4e00\u4ecb\u7ecd\u8fd910\u4e2aLinux\u57fa\u672c\u547d\u4ee4\u3002<\/p>\n

1.sudo<\/strong><\/div>\n

\u8fd9\u4e2aSuperUserDo\u662fLinux\u65b0\u624b\u8981\u4f7f\u7528\u7684\u6700\u91cd\u8981\u7684\u547d\u4ee4\u3002\u9700\u8981\u6839\u6743\u9650\u7684\u6bcf\u4e00\u4e2a\u547d\u4ee4\u90fd\u9700\u8981\u8fd9\u4e2asudo\u547d\u4ee4\u3002\u4f60\u53ef\u4ee5\u5728\u9700\u8981\u6839\u6743\u9650\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u4f7f\u7528sudo\u3002<\/p>\n

$ sudo su<\/pre>\n
2.ls(list)<\/strong><\/div>\n

\u501f\u52a9list\u547d\u4ee4\uff0c\u7ec8\u7aef\u5c31\u4f1a\u663e\u793a\u4f60\u6b63\u5728\u5904\u7406\u7684\u90a3\u4e2a\u76ee\u5f55\u91cc\u9762\u7684\u6240\u6709\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u3002\u5047\u8bbe\u6211\u5728\/home\u6587\u4ef6\u5939\u91cc\u9762\uff0c\u60f3\u67e5\u770b\/home\u91cc\u9762\u7684\u76ee\u5f55\u548c\u6587\u4ef6\u3002<\/p>\n

\/home$ ls<\/pre>\n

\/home\u4e2d\u7684ls\u8fd4\u56de\u4e0b\u5217\u7ed3\u679c\uff1a<\/p>\n

imad lost+found<\/pre>\n
3.cd<\/strong><\/div>\n

\u66f4\u6539\u76ee\u5f55(cd)\u662f\u59cb\u7ec8\u5728\u7ec8\u7aef\u4e2d\u4f7f\u7528\u7684\u4e3b\u8981\u547d\u4ee4\u3002\u5b83\u662f\u6700\u57fa\u672c\u7684Linux\u547d\u4ee4\u4e4b\u4e00\u3002\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\u5f88\u7b80\u5355\u3002\u53ea\u8981\u8f93\u5165\u4f60\u60f3\u8981\u4ece\u5f53\u524d\u76ee\u5f55\u8fdb\u5165\u5230\u7684\u90a3\u4e2a\u6587\u4ef6\u5939\u7684\u540d\u79f0\u3002\u5982\u679c\u60f3\u8981\u8fd4\u56de\u4e0a\u4e00\u7ea7\uff0c\u53ea\u8981\u5c06\u53cc\u5706\u70b9(..)\u4f5c\u4e3a\u53c2\u6570\u3002<\/p>\n

\u5047\u8bbe\u6211\u5728\/home\u76ee\u5f55\u4e2d\uff0c\u60f3\u8fdb\u5165\u5230\u59cb\u7ec8\u5728\/home\u91cc\u9762\u7684usr\u76ee\u5f55\u3002\u4e0b\u9762\u662f\u6211\u53ef\u4ee5\u4f7f\u7528cd\u547d\u4ee4\u7684\u65b9\u6cd5\uff1a<\/p>\n

\/home $ cd usr<\/pre>\n
\/home\/usr $<\/pre>\n
4.mkdir<\/strong><\/div>\n

\u4ec5\u4ec5\u66f4\u6539\u76ee\u5f55\u8fd8\u4e0d\u5168\u9762\u3002\u6709\u65f6\u5019\uff0c\u4f60\u60f3\u8981\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\u5939\u6216\u5b50\u6587\u4ef6\u5939\u3002\u53ef\u4ee5\u4f7f\u7528mkdir\u547d\u4ee4\u6765\u505a\u5230\u8fd9\u4e00\u70b9\u3002\u53ea\u8981\u5728\u7ec8\u7aef\u4e2d\u5c06\u4f60\u7684\u6587\u4ef6\u5939\u540d\u79f0\u653e\u5728mkdir\u547d\u4ee4\u7684\u540e\u9762\u5373\u53ef\u3002<\/p>\n

$ mkdir folderName<\/pre>\n
5.cp<\/strong><\/div>\n

\u62f7\u8d1d\u7c98\u8d34\u662f\u6211\u4eec\u4e3a\u4e86\u7ec4\u7ec7\u6574\u7406\u6587\u4ef6\u800c\u9700\u8981\u5b8c\u6210\u7684\u91cd\u8981\u4efb\u52a1\u3002\u4f7f\u7528cp\u5c06\u5e2e\u52a9\u4f60\u4ece\u7ec8\u7aef\u62f7\u8d1d\u7c98\u8d34\u6587\u4ef6\u3002\u9996\u5148\uff0c\u4f60\u786e\u5b9a\u60f3\u8981\u62f7\u8d1d\u7684\u90a3\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u8f93\u5165\u76ee\u7684\u5730\u4f4d\u7f6e\uff0c\u5373\u53ef\u7c98\u8d34\u6587\u4ef6\u3002<\/p>\n

$ cp src des<\/pre>\n

\u6ce8\u610f<\/strong>\uff1a\u5982\u679c\u4f60\u5c06\u6587\u4ef6\u62f7\u8d1d\u5230\u4efb\u4f55\u65b0\u6587\u4ef6\u90fd\u9700\u8981\u6839\u6743\u9650\u7684\u76ee\u5f55\uff0c\u90a3\u4e48\u4f60\u5c31\u9700\u8981\u4f7f\u7528sudo\u547d\u4ee4\u3002<\/p>\n

6.rm<\/strong><\/div>\n

rm\u8fd9\u4e2a\u547d\u4ee4\u53ef\u4ee5\u79fb\u9664\u4f60\u7684\u6587\u4ef6\uff0c\u751a\u81f3\u79fb\u9664\u4f60\u7684\u76ee\u5f55\u3002\u5982\u679c\u6587\u4ef6\u9700\u8981\u6839\u6743\u9650\u624d\u80fd\u79fb\u9664\uff0c\u53ef\u4ee5\u4f7f\u7528-f\u3002\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528-r\u6765\u8fdb\u884c\u9012\u5f52\u79fb\u9664\uff0c\u4ece\u800c\u79fb\u9664\u4f60\u7684\u6587\u4ef6\u5939\u3002<\/p>\n

$ rm myfile.txt<\/pre>\n
7.apt-get<\/strong><\/div>\n

\u5c31\u4e0d\u540c\u7684\u53d1\u884c\u7248\u800c\u8a00\uff0c\u8fd9\u4e2a\u547d\u4ee4\u5404\u4e0d\u76f8\u540c\u3002\u5728\u57fa\u4e8eDebian\u7684Linux\u53d1\u884c\u7248\u4e2d\uff0c\u60f3\u5b89\u88c5\u3001\u79fb\u9664\u548c\u5347\u7ea7\u4efb\u4f55\u8f6f\u4ef6\u5305\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u9ad8\u7ea7\u5305\u88c5\u5de5\u5177(APT)\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u3002apt-get\u547d\u4ee4\u53ef\u5e2e\u52a9\u4f60\u5b89\u88c5\u9700\u8981\u5728Linux\u4e2d\u8fd0\u884c\u7684\u8f6f\u4ef6\u3002\u8fd9\u662f\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u53ef\u4ee5\u6267\u884c\u5b89\u88c5\u3001\u5347\u7ea7\u3001\u751a\u81f3\u79fb\u9664\u8f6f\u4ef6\u8fd9\u7c7b\u4efb\u52a1\u3002<\/p>\n

\u5728\u5176\u4ed6\u53d1\u884c\u7248(\u6bd4\u5982Fedora\u548cCentos)\u4e2d\uff0c\u6709\u4e0d\u540c\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u3002Fedora\u8fc7\u53bb\u6709yum\uff0c\u4f46\u73b0\u5728\u5b83\u6709dnf\u3002<\/p>\n

$ sudo apt-get update<\/pre>\n
$sudo dnf update<\/pre>\n
8.grep<\/strong><\/div>\n

\u4f60\u9700\u8981\u627e\u5230\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u662f\u53c8\u8bb0\u4e0d\u5f97\u5b83\u7684\u786e\u5207\u4f4d\u7f6e\u6216\u8def\u5f84\u3002grep\u53ef\u4ee5\u5e2e\u52a9\u4f60\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528grep\u547d\u4ee4\uff0c\u6839\u636e\u7ed9\u5b9a\u7684\u5173\u952e\u5b57\u5e2e\u52a9\u627e\u5230\u6587\u4ef6\u3002<\/p>\n

$ grep user \/etc\/passwd<\/pre>\n
9.cat<\/strong><\/div>\n

\u4f5c\u4e3a\u7528\u6237\uff0c\u4f60\u5e38\u5e38\u9700\u8981\u67e5\u770b\u6765\u81ea\u811a\u672c\u7684\u4e00\u4e9b\u6587\u6863\u6216\u4ee3\u7801\u3002\u540c\u6837\uff0c\u5176\u4e2d\u4e00\u4e2aLinux\u57fa\u672c\u547d\u4ee4\u662fcat\u547d\u4ee4\u3002\u5b83\u4f1a\u4e3a\u4f60\u663e\u793a\u6587\u4ef6\u91cc\u9762\u7684\u6587\u672c\u3002<\/p>\n

$ cat CMakeLists.txt<\/pre>\n
10.poweroff<\/strong><\/div>\n

\u6709\u65f6\u5019\uff0c\u4f60\u9700\u8981\u76f4\u63a5\u4ece\u7ec8\u7aef\u6765\u5173\u673a\u3002\u8fd9\u4e2a\u547d\u4ee4\u5c31\u80fd\u5b8c\u6210\u8fd9\u9879\u4efb\u52a1\u3002\u522b\u5fd8\u4e86\u5728\u547d\u4ee4\u7684\u5f00\u5934\u6dfb\u52a0sudo\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u6839\u6743\u9650\u624d\u80fd\u6267\u884cpoweroff\u3002<\/p>\n

$ sudo poweroff<\/pre>\n
\u7ed3\u675f\u8bed<\/strong><\/div>\n

\u6b63\u5982\u6211\u5728\u6587\u7ae0\u5f00\u5934\u63d0\u5230\uff1a\u8fd910\u4e2a\u57fa\u672c\u7684Linux\u547d\u4ee4\u4e0d\u4f1a\u7acb\u9a6c\u8ba9\u4f60\u53d8\u6210Linux\u6781\u5ba2\u3002\u5b83\u4f1a\u5e2e\u52a9\u4f60\u5728\u8fd9\u4e2a\u65e9\u671f\u9636\u6bb5\u5f00\u59cb\u4f7f\u7528Linux\u3002\u501f\u52a9\u8fd9\u4e9b\u57fa\u672c\u7684Linux\u547d\u4ee4\uff0c\u5f00\u59cb\u4f7f\u7528Linux\uff0c\u5e76\u4e14\u5b9a\u4e2a\u76ee\u6807\uff1a\u6bcf\u5929\u5b66\u4f1a\u4f7f\u75281\u4e2a\u81f33\u4e2a\u547d\u4ee4\u3002\u8fd9\u5c31\u662f\u672c\u6587\u7684\u76ee\u7684\uff0c\u4f46\u613f\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n

<\/div>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/os.51cto.com\/art\/201606\/513081.htm<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/10-linux-commands.html<\/a>\u7f16\u8f91\u5458\uff1a\u90ed\u5efa\u9e4f\uff0c\u5ba1\u6838\u5458\uff1a\u82cf\u897f\u4e91<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u301051CTO.com\u5feb\u8bd1\u3011Linux\u5bf9\u6211\u4eec\u7684\u751f\u6d3b\u6709\u7740\u5f88\u5927\u7684\u5f71\u54cd\u3002\u81f3\u5c11\uff0c\u4f60\u7684\u5b89\u5353\u624b\u673a\u4e0a\u9762\u5c31\u6709Linux\u5185\u6838\u3002\u7136\u800c\uff0c\u5934\u4e00\u6b21\u5165\u624bLinux\u53ea\u4f1a\u8ba9\u4f60\u89c9\u5f97\u4e0d\u9002\u3002\u56e0\u4e3a\u5728Linux\u4e0a\uff0c\u4f60\u901a\u5e38\u5e94\u8be5\u4f7f\u7528\u7ec8\u7aef\u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u53ea\u8981\u70b9\u51fb\u542f\u52a8\u5668\u56fe\u50cf(\u5c31\u50cf\u4f60\u5728Windows\u4e0a\u64cd\u4f5c\u90a3\u6837)\u3002\u4e0d\u8fc7\u522b\u62c5\u5fc3\uff0c\u4e0b\u9762\u4ecb\u7ecd\u7684\u8fd910\u4e2a\u57fa\u672c\u7684Linux\u547d\u4ee4\u548c\u91cd\u8981\u547d\u4ee4\u4f1a\u5e2e\u52a9\u4f60\u5c3d\u5feb\u5165\u95e8\u3002<\/p>\n","protected":false},"author":323,"featured_media":28276,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-19368","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\/19368","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\/323"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=19368"}],"version-history":[{"count":17,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/19368\/revisions"}],"predecessor-version":[{"id":258987,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/19368\/revisions\/258987"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/28276"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=19368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=19368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=19368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}