{"id":281480,"date":"2023-08-30T20:05:54","date_gmt":"2023-08-30T12:05:54","guid":{"rendered":"https:\/\/lrxjmw.cn\/lzmmwjjyfx.html"},"modified":"2023-08-30T20:05:54","modified_gmt":"2023-08-30T12:05:54","slug":"lzmmwjjyfx","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lzmmwjjyfx.html","title":{"rendered":"Linux\u91cd\u547d\u540d\u6587\u4ef6\uff1a\u7ecf\u9a8c\u5206\u4eab\uff01"},"content":{"rendered":"

\u5728\u4f7f\u7528Linux<\/a>\u7cfb\u7edf<\/a>\u65f6\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u5bf9\u6587\u4ef6\u8fdb\u884c\u91cd\u547d\u540d\u3002\u91cd\u547d\u540d\u6587\u4ef6\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u7ec4\u7ec7\u548c\u7ba1\u7406\u6587\u4ef6\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002\u4e0b\u9762\u5c0f\u7f16\u5c06\u5206\u4eab\u4e00\u4e9b\u5173\u4e8eLinux\u91cd\u547d\u540d\u6587\u4ef6\u7684\u7ecf\u9a8c\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n

1.\u4f7f\u7528mv\u547d\u4ee4<\/a>\u8fdb\u884c\u7b80\u5355\u7684\u91cd\u547d\u540d<\/p>\n

mv\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u6700\u5e38\u7528\u7684\u6587\u4ef6\u64cd\u4f5c\u547d\u4ee4\u4e4b\u4e00\uff0c\u5b83\u4e0d\u4ec5\u53ef\u4ee5\u7528\u6765\u79fb\u52a8\u6587\u4ef6\uff0c\u8fd8\u53ef\u4ee5\u7528\u6765\u91cd\u547d\u540d\u6587\u4ef6\u3002\u4f7f\u7528mv\u547d\u4ee4\u8fdb\u884c\u7b80\u5355\u7684\u91cd\u547d\u540d\u975e\u5e38\u65b9\u4fbf\uff0c\u53ea\u9700\u8981\u6307\u5b9a\u539f\u6587\u4ef6\u540d\u548c\u65b0\u6587\u4ef6\u540d\u5373\u53ef\u3002\u4f8b\u5982\uff1a<\/p>\n

\n

\n   mv oldfile.txt newfile.txt\n   <\/pre>\n<\/p>\n

\u8fd9\u6761\u547d\u4ee4\u5c06\u628a\u539f\u6765\u7684oldfile.txt\u6587\u4ef6\u91cd\u547d\u540d\u4e3anewfile.txt\u3002<\/p>\n

2.\u6279\u91cf\u91cd\u547d\u540d\u591a\u4e2a\u6587\u4ef6<\/p>\n

\u5f53\u6211\u4eec\u9700\u8981\u6279\u91cf\u91cd\u547d\u540d\u591a\u4e2a\u6587\u4ef6\u65f6\uff0c\u624b\u52a8\u4e00\u4e2a\u4e00\u4e2a\u4fee\u6539\u663e\u7136\u662f\u975e\u5e38\u7e41\u7410\u7684\u3002\u5e78\u8fd0\u7684\u662f\uff0cLinux\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u6279\u91cf\u91cd\u547d\u540d\u591a\u4e2a\u6587\u4ef6\u3002<\/p>\n

2.1\u4f7f\u7528\u901a\u914d\u7b26<\/p>\n

\u901a\u914d\u7b26\u662fLinux\u4e2d\u975e\u5e38\u5f3a\u5927\u7684\u529f\u80fd\u4e4b\u4e00\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5feb\u901f\u5339\u914d\u591a\u4e2a\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6211\u4eec\u8981\u5c06\u6240\u6709\u4ee5.txt\u7ed3\u5c3e\u7684\u6587\u4ef6\u90fd\u6539\u4e3a.doc\u7ed3\u5c3e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n       mv *.txt *.doc\n       <\/pre>\n<\/p>\n

\u8fd9\u6837\u5c31\u53ef\u4ee5\u5c06\u6240\u6709\u4ee5.txt\u7ed3\u5c3e\u7684\u6587\u4ef6\u90fd\u6279\u91cf\u91cd\u547d\u540d\u4e3a\u4ee5.doc\u7ed3\u5c3e\u3002<\/p>\n

2.2\u4f7f\u7528rename\u547d\u4ee4<\/p>\n

rename\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u4e00\u4e2a\u975e\u5e38\u5b9e\u7528\u7684\u5de5\u5177linux\u6559\u7a0b\uff0c\u5b83\u53ef\u4ee5\u6839\u636e\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u6279\u91cf\u91cd\u547d\u540d\u591a\u4e2a\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6211\u4eec\u8981\u5c06\u6240\u6709\u4ee5old\u5f00\u5934\u7684\u6587\u4ef6\u90fd\u6539\u4e3anew\u5f00\u5934linux\u91cd\u547d\u540d\u6587\u4ef6<\/strong>\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n       rename 's\/^old\/new\/'*\n       <\/pre>\n<\/p>\n

\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5c06\u6240\u6709\u4ee5old\u5f00\u5934\u7684\u6587\u4ef6\u90fd\u6279\u91cf\u91cd\u547d\u540d\u4e3a\u4ee5new\u5f00\u5934\u3002<\/p>\n

3.\u6dfb\u52a0\u524d\u7f00\u6216\u540e\u7f00<\/p>\n

\u6709\u65f6\u5019\u6211\u4eec\u9700\u8981\u7ed9\u6587\u4ef6\u6dfb\u52a0\u4e00\u4e9b\u524d\u7f00\u6216\u540e\u7f00\u6765\u533a\u5206\u5b83\u4eec\u7684\u7528\u9014\u3002\u5728Linux\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e9b\u7b80\u5355\u7684\u65b9\u6cd5\u5b9e\u73b0\u8fd9\u4e2a\u76ee\u6807\u3002<\/p>\n

3.1\u4f7f\u7528mv\u547d\u4ee4\u548c\u53d8\u91cf<\/p>\n

\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528mv\u547d\u4ee4\u548c\u53d8\u91cf\u6765\u7ed9\u6587\u4ef6\u6dfb\u52a0\u524d\u7f00\u6216\u540e\u7f00\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6211\u4eec\u8981\u5c06file.txt\u6539\u4e3aprefix_file.txt\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n       prefix="prefix_"\n       mv file.txt "${prefix}file.txt"\n       <\/pre>\n<\/p>\n

\u8fd9\u6837\u5c31\u53ef\u4ee5\u7ed9\u6587\u4ef6\u6dfb\u52a0\u4e86\u524d\u7f00prefix_\u3002<\/p>\n

3.2\u4f7f\u7528rename\u547d\u4ee4\u548c\u6b63\u5219\u8868\u8fbe\u5f0f<\/p>\n

rename\u547d\u4ee4\u4e5f\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u7ed9\u6587\u4ef6\u6dfb\u52a0\u524d\u7f00\u6216\u540e\u7f00\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6211\u4eec\u8981\u5c06\u6240\u6709\u4ee5.txt\u7ed3\u5c3e\u7684\u6587\u4ef6\u90fd\u6dfb\u52a0\u540e\u7f00\"_backup\"\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n       rename 's\/(.*).txt$\/$1_backup.txt\/'*.txt\n       <\/pre>\n<\/p>\n

\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5c06\u6240\u6709\u4ee5.txt\u7ed3\u5c3e\u7684\u6587\u4ef6\u90fd\u6dfb\u52a0\u540e\u7f00\"_backup\"\u3002<\/p>\n

4.\u907f\u514d\u91cd\u590d\u547d\u540d\u548c\u8986\u76d6\u6587\u4ef6<\/p>\n

\u5728\u8fdb\u884c\u6587\u4ef6\u91cd\u547d\u540d\u65f6\uff0c\u6211\u4eec\u9700\u8981\u6ce8\u610f\u907f\u514d\u91cd\u590d\u547d\u540d\u548c\u8986\u76d6\u6587\u4ef6\u3002\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u53d1\u751flinux\u91cd\u547d\u540d\u6587\u4ef6<\/strong>\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u91cd\u547d\u540d\u4e4b\u524d\u5148\u68c0\u67e5\u76ee\u6807\u6587\u4ef6\u662f\u5426\u5df2\u7ecf\u5b58\u5728\u3002<\/p>\n

4.1\u4f7f\u7528test\u547d\u4ee4<\/p>\n

test\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u3002\u5728\u8fdb\u884c\u91cd\u547d\u540d\u4e4b\u524d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528test\u547d\u4ee4\u5224\u65ad\u76ee\u6807\u6587\u4ef6\u662f\u5426\u5df2\u7ecf\u5b58\u5728\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5224\u65ad\u76ee\u6807\u6587\u4ef6\u662f\u5426\u5b58\u5728\u7684\u793a\u4f8b\uff1a<\/p>\n

\n

\n       if [-e newfile.txt ]; then\n           echo "newfile.txt already exists!"\n       else\n           mv oldfile.txt newfile.txt\n       fi\n       <\/pre>\n<\/p>\n

4.2\u4f7f\u7528rename\u547d\u4ee4\u7684-d\u9009\u9879<\/p>\n

rename\u547d\u4ee4\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e2a-d\u9009\u9879\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u907f\u514d\u8986\u76d6\u6587\u4ef6\u3002\u5f53\u76ee\u6807\u6587\u4ef6\u5df2\u7ecf\u5b58\u5728\u65f6\uff0c\u4f7f\u7528-d\u9009\u9879\u4f1a\u81ea\u52a8\u7ed9\u65b0\u6587\u4ef6\u6dfb\u52a0\u4e00\u4e2a\u6570\u5b57\u540e\u7f00\uff0c\u4fdd\u8bc1\u4e0d\u4f1a\u8986\u76d6\u539f\u6709\u6587\u4ef6\u3002<\/p>\n

\u547d\u540d\u6587\u4ef6\u5939_linux\u91cd\u547d\u540d\u6587\u4ef6_\u547d\u540d\u6587\u4ef6\u5feb\u6377\u952e<\/p>\n

5.\u5c0f\u7ed3\u548c\u6ce8\u610f\u4e8b\u9879<\/p>\n

\u5728\u8fdb\u884cLinux\u6587\u4ef6\u91cd\u547d\u540d\u65f6\uff0c\u6211\u4eec\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n

-\u786e\u4fdd\u4f7f\u7528mv\u547d\u4ee4\u6216rename\u547d\u4ee4\u65f6\u6307\u5b9a\u6b63\u786e\u7684\u6e90\u6587\u4ef6\u540d\u548c\u76ee\u6807\u6587\u4ef6\u540d\u3002<\/p>\n

-\u6ce8\u610f\u5907\u4efd\u91cd\u8981\u7684\u6587\u4ef6\uff0c\u5728\u8fdb\u884c\u6279\u91cf\u91cd\u547d\u540d\u64cd\u4f5c\u65f6\u5c24\u5176\u8981\u5c0f\u5fc3\u3002<\/p>\n

-\u5f53\u6d89\u53ca\u5230\u6b63\u5219\u8868\u8fbe\u5f0f\u65f6\uff0c\u8981\u786e\u4fdd\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u51c6\u786e\u6027\uff0c\u4ee5\u514d\u51fa\u73b0\u610f\u5916\u60c5\u51b5\u3002<\/p>\n

\u901a\u8fc7\u638c\u63e1\u8fd9\u4e9b\u7ecf\u9a8c\uff0c\u6211\u4eec\u53ef\u4ee5\u66f4\u52a0\u65b9\u4fbf\u5730\u8fdb\u884cLinux\u6587\u4ef6\u91cd\u547d\u540d\u64cd\u4f5c\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\uff0c\u8282\u7701\u65f6\u95f4\u3002<\/p>\n

\u4ee5\u4e0a\u5c31\u662f\u5173\u4e8eLinux\u91cd\u547d\u540d\u6587\u4ef6\u7684\u7ecf\u9a8c\u5206\u4eablinux\u547d\u4ee4\u624b\u518c\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002\u5982\u679c\u4f60\u8fd8\u6709\u5176\u4ed6\u5173\u4e8eLinux\u7684\u95ee\u9898\u6216\u8005\u7ecf\u9a8c\u5206\u4eab\uff0c\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u8a00\u8ba8\u8bba\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e0b\u9762\u5c0f\u7f16\u5c06\u5206\u4eab\u4e00\u4e9b\u5173\u4e8eLinux\u91cd\u547d\u540d\u6587\u4ef6\u7684\u7ecf\u9a8c\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002\u5e78\u8fd0\u7684\u662f\uff0cLinux\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u6279\u91cf\u91cd\u547d\u540d\u591a\u4e2a\u6587\u4ef6\u3002rename\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e2d\u4e00\u4e2a\u975e\u5e38\u5b9e\u7528\u7684\u5de5\u5177\uff0c\u5b83\u53ef\u4ee5\u6839\u636e\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u6279\u91cf\u91cd\u547d\u540d\u591a\u4e2a\u6587\u4ef6\u3002\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5c06\u6240\u6709\u4ee5old\u5f00\u5934\u7684\u6587\u4ef6\u90fd\u6279\u91cf\u91cd\u547d\u540d\u4e3a\u4ee5new\u5f00\u5934\u3002\u4ee5\u4e0a\u5c31\u662f\u5173\u4e8eLinux\u91cd\u547d\u540d\u6587\u4ef6\u7684\u7ecf\u9a8c\u5206\u4eab\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"author":1,"featured_media":281481,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-281480","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\/281480","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=281480"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/281480\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/281481"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=281480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=281480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=281480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}