{"id":267057,"date":"2023-03-16T06:06:28","date_gmt":"2023-03-15T22:06:28","guid":{"rendered":"https:\/\/lrxjmw.cn\/lczjdljdzffq.html"},"modified":"2023-03-16T06:06:28","modified_gmt":"2023-03-15T22:06:28","slug":"lczjdljdzffq","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lczjdljdzffq.html","title":{"rendered":"Linux\u67e5\u627e\u7edd\u5bf9\u8def\u5f84\uff1a\u591a\u79cd\u65b9\u6cd5\u8f7b\u677e\u5b9a\u4f4d\u6587\u4ef620\u5b57\u5de6\u53f3"},"content":{"rendered":"

\u5728Linux<\/a>\u7cfb\u7edf<\/a>\u4e2d\uff0c\u6211\u4eec\u5e38\u5e38\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84<\/a>linux \u67e5\u627e\u7edd\u5bf9\u8def\u5f84<\/strong>\uff0c\u4ee5\u4fbf\u8fdb\u884c\u76f8\u5173\u64cd\u4f5c\u3002\u672c\u6587\u5c06\u4e3a\u60a8\u4ecb\u7ecd\u591a\u79cd\u65b9\u6cd5\u6765\u67e5\u627e\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u8ba9\u60a8\u8f7b\u677e\u5b9a\u4f4d\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n

\u4e00\u3001\u4f7f\u7528pwd\u547d\u4ee4<\/a>\u67e5\u627e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55<\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528pwd\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u6240\u5728\u7684\u5de5\u4f5c\u76ee\u5f55\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\u65f6\uff0c\u53ef\u4ee5\u5148\u8fdb\u5165\u8be5\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\uff0c\u7136\u540e\u4f7f\u7528pwd\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u6240\u5728\u76ee\u5f55\u7684\u7edd\u5bf9\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\ncd \/etc\npwd\n<\/pre>\n<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u8f93\u51fa\/etc\u76ee\u5f55\u7684\u7edd\u5bf9\u8def\u5f84\u3002<\/p>\n

\u4e8c\u3001\u4f7f\u7528find\u547d\u4ee4\u67e5\u627e\u6587\u4ef6<\/p>\n

find\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u975e\u5e38\u5e38\u7528\u7684\u4e00\u4e2a\u547d\u4ee4\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u67e5\u627e\u6307\u5b9a\u540d\u79f0\u3001\u7c7b\u578b\u3001\u5927\u5c0f\u7b49\u5c5e\u6027\u7684\u6587\u4ef6\uff0c\u5e76\u8fd4\u56de\u7b26\u5408\u6761\u4ef6\u7684\u6587\u4ef6\u5217\u8868\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528find\u547d\u4ee4\u6765\u641c\u7d22\u8be5\u6587\u4ef6\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\nfind \/-name myfile.txt\n<\/pre>\n<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u641c\u7d22\u6574\u4e2a\u6839\u76ee\u5f55\u4e0b\u6240\u6709\u540d\u4e3amyfile.txt\u7684\u6587\u4ef6\uff0c\u5e76\u8fd4\u56de\u5b83\u4eec\u7684\u8def\u5f84\u3002<\/p>\n

\u4e09\u3001\u4f7f\u7528locate\u547d\u4ee4\u67e5\u627e\u6587\u4ef6<\/p>\n

locate\u547d\u4ee4\u662f\u4e00\u4e2a\u975e\u5e38\u5feb\u901f\u548c\u9ad8\u6548\u7684\u641c\u7d22\u5de5\u5177\uff0c\u5b83\u4f1a\u5728\u4e00\u4e2a\u9884\u5b9a\u4e49\u597d\u7684\u6570\u636e\u5e93\u4e2d\u641c\u7d22\u7b26\u5408\u6761\u4ef6\u7684\u6587\u4ef6\uff0c\u5e76\u8fd4\u56de\u5b83\u4eec\u7684\u8def\u5f84\u3002\u4f46\u662flinux\u4f7f\u7528\u6559\u7a0b\uff0c\u7531\u4e8e\u8be5\u6570\u636e\u5e93\u4e0d\u662f\u5b9e\u65f6\u66f4\u65b0\u7684linux \u67e5\u627e\u7edd\u5bf9\u8def\u5f84<\/strong>\uff0c\u56e0\u6b64\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e00\u4e9b\u8bef\u5dee\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528locate\u547d\u4ee4\u6765\u641c\u7d22\u8be5\u6587\u4ef6\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\nlocate myfile.txt\n<\/pre>\n<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u641c\u7d22\u6574\u4e2a\u7cfb\u7edf\u4e2d\u6240\u6709\u540d\u4e3amyfile.txt\u7684\u6587\u4ef6\uff0c\u5e76\u8fd4\u56de\u5b83\u4eec\u7684\u8def\u5f84\u3002<\/p>\n

\u56db\u3001\u4f7f\u7528which\u547d\u4ee4\u67e5\u627e\u53ef\u6267\u884c\u7a0b\u5e8f<\/p>\n

which\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u67e5\u627e\u53ef\u6267\u884c\u7a0b\u5e8f\u6240\u5728\u7684\u4f4d\u7f6e\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u53ef\u6267\u884c\u7a0b\u5e8f\u6240\u5728\u4f4d\u7f6e\u65f6linux\u4e3b\u673a\uff0c\u53ef\u4ee5\u4f7f\u7528which\u547d\u4ee4\u6765\u641c\u7d22\u8be5\u7a0b\u5e8f\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\nwhich python\n<\/pre>\n<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u8f93\u51fapython\u53ef\u6267\u884c\u7a0b\u5e8f\u6240\u5728\u4f4d\u7f6e\u7684\u7edd\u5bf9\u8def\u5f84\u3002<\/p>\n

\u4e94\u3001\u4f7f\u7528type\u547d\u4ee4\u67e5\u627eshell\u5185\u7f6e\u547d\u4ee4<\/p>\n

type\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u5224\u65ad\u6307\u5b9a\u540d\u79f0\u662f\u5426\u4e3ashell\u5185\u7f6e\u547d\u4ee4\uff0c\u5e76\u8fd4\u56de\u8be5\u5185\u7f6e\u547d\u4ee4\u6240\u5728\u4f4d\u7f6e\u4fe1\u606f\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u627e\u67d0\u4e2ashell\u5185\u7f6e\u547d\u4ee4\u6240\u5728\u4f4d\u7f6e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528type\u547d\u4ee4\u6765\u641c\u7d22\u8be5\u5185\u7f6e\u547d\u4ee4\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\ntype pwd\n<\/pre>\n<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u8f93\u51fapwd\u5185\u7f6e\u547d\u4ee4\u6240\u5728\u4f4d\u7f6e\u4fe1\u606f\u3002<\/p>\n

\u516d\u3001\u4f7f\u7528whereis\u547d\u4ee4\u67e5\u627e\u4e8c\u8fdb\u5236\u7a0b\u5e8f\u3001\u6e90\u4ee3\u7801\u548c\u5e2e\u52a9\u6587\u6863<\/p>\n

whereis \u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u67e5\u8be2\u4e8c\u8fdb\u5236\u7a0b\u5e8f\u3001\u6e90\u4ee3\u7801\u548c\u5e2e\u52a9\u6587\u6863\u6240\u5728\u4f4d\u7f6e\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u8be2\u67d0\u4e2a\u4e8c\u8fdb\u5236\u7a0b\u5e8f\u3001\u6e90\u4ee3\u7801\u6216\u5e2e\u52a9\u6587\u6863\u6240\u5728\u4f4d\u7f6e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528whereis \u547d\u4ee4\u6765\u641c\u7d22\u5b83\u4eec\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\nwhereis python\n<\/pre>\n<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u8f93\u51fapython\u53ef\u6267\u884c\u7a0b\u5e8f\u3001\u6e90\u4ee3\u7801\u548c\u5e2e\u52a9\u6587\u6863\u6240\u5728\u4f4d\u7f6e\u4fe1\u606f\u3002<\/p>\n

\u4e03\u3001\u4f7f\u7528ls -l\u547d\u4ee4\u663e\u793a\u8be6\u7ec6\u4fe1\u606f\u5e76\u786e\u5b9a\u7edd\u5bf9\u8def\u5f84<\/p>\n

ls -l\u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u6307\u5b9a\u76ee\u5f55\u4e0b\u6240\u6709\u6587\u4ef6\u53ca\u5176\u8be6\u7ec6\u4fe1\u606f\uff0c\u5e76\u4e14\u5176\u4e2d\u5305\u542b\u4e86\u6bcf\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6743\u9650\u3001\u5c5e\u4e3b\u548c\u5c5e\u7ec4\u7b49\u4fe1\u606f\u3002\u901a\u8fc7\u8fd9\u4e9b\u8be6\u7ec6\u4fe1\u606f\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u5b9a\u67d0\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u7edd\u5bf9\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/p>\n

linux vi\u67e5\u627e\u5b57\u7b26\u4e32_linux \u67e5\u627e\u7edd\u5bf9\u8def\u5f84_linux find\u547d\u4ee4\u67e5\u627e\u5b57\u7b26\u4e32<\/p>\n

\n

\nls -l\/etc\/passwd\n<\/pre>\n<\/p>\n

\u8be5\u547d\u4ee4\u5c06\u8f93\u51fa\/etc\/passwd \u6587\u4ef6\u8be6\u7ec6\u4fe1\u606f\u5e76\u786e\u5b9a\u5176\u7edd\u5bf9\u8def\u5f84\u3002<\/p>\n

\u516b\u3001\u4f7f\u7528realpath \u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u8def\u5f84\u771f\u5b9e\u5730\u5740<\/p>\n

realpath \u547d\u4ee4\u53ef\u4ee5\u83b7\u53d6\u6307\u5b9a\u8def\u5f84\u771f\u5b9e\u5730\u5740\uff0c\u5e76\u4e14\u5b83\u4f1a\u89e3\u6790\u6240\u6709\u7b26\u53f7\u94fe\u63a5\u548c“..”\u4e0a\u4e00\u7ea7\u76ee\u5f55\u7b26\u53f7\u3002\u5f53\u6211\u4eec\u9700\u8981\u83b7\u53d6\u67d0\u4e2a\u8def\u5f84\u771f\u5b9e\u5730\u5740\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528realpath \u547d\u540d\u6765\u89e3\u6790\u5176\u771f\u5b9e\u5730\u5740\u5e76\u8fd4\u56de\u5176\u7edd\u5bf9\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\nrealpath \/usr\/local\/bin\/python3.9\n<\/pre>\n<\/p>\n

\u8be5\u547d\u540d\u5c06\u89e3\u6790\/usr\/local\/bin\/python3.9\u7684\u771f\u5b9e\u5730\u5740\u5e76\u8fd4\u56de\u5176\u7edd\u5bf9\u8def\u5f84\u3002<\/p>\n

\u4e5d\u3001\u603b\u7ed3<\/p>\n

\u672c\u6587\u4ecb\u7ecd\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u67e5\u627eLinux\u7cfb\u7edf\u4e2d\u67d0\u4e2a\u6587\u4ef6\u6216\u53ef\u6267\u884c\u7a0b\u5e8f\u7b49\u5bf9\u8c61\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u5e76\u9010\u6b65\u5206\u6790\u4e86\u5404\u79cd\u65b9\u6cd5\u539f\u7406\u53ca\u5e94\u7528\u573a\u666f\u3002\u65e0\u8bba\u662f\u521d\u5b66\u8005\u8fd8\u662f\u6709\u7ecf\u9a8c\u8005\u90fd\u80fd\u4ece\u672c\u6587\u4e2d\u5b66\u5230\u4e0d\u5c11\u6709\u5173Linux\u7cfb\u7edf\u4e2d\u5982\u4f55\u67e5\u8be2\u5bf9\u8c61\u7edd\u5bf9\u8def\u5f84\u53ca\u5982\u4f55\u9009\u62e9\u5408\u9002\u65b9\u6cd5\u8fdb\u884c\u67e5\u8be2\u7b49\u77e5\u8bc6\u70b9\uff0c\u5728\u65e5\u5e38\u5de5\u4f5c\u4e2d\u66f4\u52a0\u5f97\u5fc3\u5e94\u624b\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u5e38\u5e38\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u4ee5\u4fbf\u8fdb\u884c\u76f8\u5173\u64cd\u4f5c\u3002\u672c\u6587\u5c06\u4e3a\u60a8\u4ecb\u7ecd\u591a\u79cd\u65b9\u6cd5\u6765\u67e5\u627e\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u8ba9\u60a8\u8f7b\u677e\u5b9a\u4f4d\u6587\u4ef6\u8def\u5f84\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528find\u547d\u4ee4\u6765\u641c\u7d22\u8be5\u6587\u4ef6\u3002\u5f53\u6211\u4eec\u9700\u8981\u67e5\u627e\u67d0\u4e2a\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528locate\u547d\u4ee4\u6765\u641c\u7d22\u8be5\u6587\u4ef6\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u67e5\u627eLinux\u7cfb\u7edf\u4e2d\u67d0\u4e2a\u6587\u4ef6\u6216\u53ef\u6267\u884c\u7a0b\u5e8f\u7b49\u5bf9\u8c61\u7684\u7edd\u5bf9\u8def\u5f84\uff0c\u5e76\u9010\u6b65\u5206\u6790\u4e86\u5404\u79cd\u65b9\u6cd5\u539f\u7406\u53ca\u5e94\u7528\u573a\u666f\u3002<\/p>\n","protected":false},"author":1,"featured_media":267058,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-267057","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/267057","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=267057"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/267057\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/267058"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=267057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=267057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=267057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}