{"id":15018,"date":"2023-05-23T20:07:22","date_gmt":"2023-05-23T12:07:22","guid":{"rendered":"https:\/\/www.linuxcool.com\/ldbmltjqfx"},"modified":"2023-05-23T20:07:22","modified_gmt":"2023-05-23T12:07:22","slug":"ldbmltjqfx","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/ldbmltjqfx","title":{"rendered":"Linux\u6253\u5305\u547d\u4ee4tar\uff1a\u6280\u5de7\u5206\u4eab"},"content":{"rendered":"<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><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>\u4e0b\u7684tar<a style='color:#0000CC' href='https:\/\/www.linuxcool.com\/' target='_blank' rel=\"noopener\">\u547d\u4ee4<\/a>\uff0c\u662f\u4e00\u79cd\u5e38\u7528\u7684\u6587\u4ef6\u6253\u5305\u548c\u538b\u7f29\u547d\u4ee4\uff0c\u5b83\u80fd\u591f\u5c06\u591a\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\u6253\u5305\u6210\u4e00\u4e2a\u6587\u4ef6linux\u83b7\u53d6\u5f53\u524d\u65f6\u95f4\uff0c\u5e76\u8fdb\u884c\u538b\u7f29\u3002\u5728\u5b9e\u9645\u5de5\u4f5c\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u4f7f\u7528tar\u547d\u4ee4\u6765\u5907\u4efd\u3001\u4f20\u8f93\u6216\u5f52\u6863\u6587\u4ef6\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdLinux\u6253\u5305\u547d\u4ee4tar\u7684\u76f8\u5173\u77e5\u8bc6\u548c\u6280\u5de7\uff0c\u5e2e\u52a9\u5927\u5bb6\u66f4\u597d\u5730\u4f7f\u7528\u8be5\u547d\u4ee4\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u4e00\u3001tar\u547d\u4ee4\u7b80\u4ecb<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>tar\uff08tape archive\uff09\u662f\u4e00\u79cd\u5728Unix\u548c\u7c7bUnix\u7cfb\u7edf\u4e0a\u7528\u6765\u5f52\u6863\u6587\u4ef6\u7684\u5b9e\u7528\u7a0b\u5e8f\u3002\u5b83\u80fd\u591f\u5c06\u591a\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\u6253\u5305\u6210\u4e00\u4e2a\u6587\u4ef6red hat linux\uff0c\u5e76\u8fdb\u884c\u538b\u7f29\u3002\u5e38\u89c1\u7684\u6269\u5c55\u540d\u4e3a.tar\u3001.tgz\u3001.tar.gz\u7b49\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u4e8c\u3001\u57fa\u672c\u8bed\u6cd5<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>tar\u547d\u4ee4\u7684\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar [\u9009\u9879][\u6587\u4ef6\u540d]\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5176\u4e2d<strong>linux\u6253\u5305\u547d\u4ee4 tar<\/strong>\uff0c\u9009\u9879\u901a\u5e38\u7528\u4e8e\u6307\u5b9a\u6253\u5305\u6216\u89e3\u5305\u65f6\u7684\u4e00\u4e9b\u53c2\u6570\u6216\u64cd\u4f5c\u65b9\u5f0f\uff1b\u6587\u4ef6\u540d\u5219\u6307\u5b9a\u8981\u6253\u5305\u6216\u89e3\u5305\u7684\u6587\u4ef6\u6216\u76ee\u5f55\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u7528\u9009\u9879\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>--c\uff1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5f52\u6863\u6587\u4ef6\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>--x\uff1a\u4ece\u5f52\u6863\u6587\u4ef6\u4e2d\u63d0\u53d6\u6587\u4ef6\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>--f\uff1a\u6307\u5b9a\u5f52\u6863\u6587\u4ef6\u540d\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>--v\uff1a\u663e\u793a\u6b63\u5728\u5904\u7406\u7684\u6587\u4ef6\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>--z\uff1a\u5bf9\u5f52\u6863\u6587\u4ef6\u8fdb\u884cgzip\u538b\u7f29\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>--j\uff1a\u5bf9\u5f52\u6863\u6587\u4ef6\u8fdb\u884cbzip2\u538b\u7f29\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u7528\u7684tar\u547d\u4ee4\u793a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u4e09\u3001\u6253\u5305\u64cd\u4f5c<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6253\u5305\u64cd\u4f5c\u662ftar\u547d\u4ee4\u6700\u57fa\u672c\u7684\u529f\u80fd\u4e4b\u4e00\uff0c\u5b83\u53ef\u4ee5\u5c06\u591a\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\u6253\u5305\u6210\u4e00\u4e2a\u6587\u4ef6\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6253\u5305\u793a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar -cvf test.tar file1 file2\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u547d\u4ee4\u5c06file1\u548cfile2\u4e24\u4e2a\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u540d\u4e3atest.tar\u7684\u5f52\u6863\u6587\u4ef6\u3002\u5176\u4e2d\uff0c\u9009\u9879-c\u8868\u793a\u521b\u5efa\u65b0\u7684\u5f52\u6863\u6587\u4ef6\uff0c-v\u8868\u793a\u663e\u793a\u6b63\u5728\u5904\u7406\u7684\u6587\u4ef6\uff0c-f\u6307\u5b9a\u5f52\u6863\u6587\u4ef6\u540d\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u56db\u3001\u538b\u7f29\u64cd\u4f5c<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>Linux\u7cfb\u7edf\u4e0b\u6709\u591a\u79cd\u538b\u7f29\u65b9\u5f0f\u53ef\u4f9b\u9009\u62e9\uff0c\u5982gzip\u3001bzip2\u7b49\u3002tar\u547d\u4ee4\u4e5f\u63d0\u4f9b\u4e86gzip\u548cbzip2\u4e24\u79cd\u538b\u7f29\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5c06\u6253\u5305\u597d\u7684\u5f52\u6863\u6587\u4ef6\u8fdb\u884c\u538b\u7f29\u3002\u4e0b\u9762\u662f\u4e24\u4e2a\u7b80\u5355\u7684\u538b\u7f29\u793a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4f7f\u7528gzip\u8fdb\u884c\u538b\u7f29\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar -czvf test.tar.gz file1 file2\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4f7f\u7528bzip2\u8fdb\u884c\u538b\u7f29\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar -cjvf test.tar.bz2 file1 file2\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u547d\u4ee4\u5206\u522b\u5c06file1\u548cfile2\u4e24\u4e2a\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u540d\u4e3atest.tar.gz\u6216test.tar.bz2\u7684\u5f52\u6863\u6587\u4ef6\uff0c\u5e76\u5bf9\u5176\u8fdb\u884cgzip\u6216bzip2\u538b\u7f29\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u4e94\u3001\u89e3\u5305\u64cd\u4f5c<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u89e3\u5305\u64cd\u4f5c\u662ftar\u547d\u4ee4\u53e6\u4e00\u4e2a\u57fa\u672c\u529f\u80fd<strong>linux\u6253\u5305\u547d\u4ee4 tar<\/strong>\uff0c\u5b83\u53ef\u4ee5\u4ece\u5f52\u6863\u6587\u4ef6\u4e2d\u63d0\u53d6\u6587\u4ef6\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u89e3\u5305\u793a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar -xvf test.tar\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u547d\u4ee4\u5c06test.tar\u5f52\u6863\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u89e3\u5305\u5230\u5f53\u524d\u76ee\u5f55\u4e0b\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u516d\u3001\u6392\u9664\u6587\u4ef6<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6709\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u5c06\u4e00\u4e2a\u76ee\u5f55\u6253\u5305\u6210\u5f52\u6863\u6587\u4ef6\uff0c\u4f46\u53c8\u4e0d\u5e0c\u671b\u5176\u4e2d\u7684\u67d0\u4e9b\u6587\u4ef6\u88ab\u6253\u5305\u8fdb\u53bb\u3002\u6b64\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528--exclude\u9009\u9879\u6765\u6392\u9664\u6307\u5b9a\u6587\u4ef6\u6216\u76ee\u5f55\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6392\u9664\u793a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar -cvf test.tar --exclude=*.log dir\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u547d\u4ee4\u5c06dir\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u6253\u5305\u6210test.tar\u5f52\u6863\u6587\u4ef6\uff0c\u4f46\u6392\u9664\u4e86\u6240\u6709\u4ee5.log\u7ed3\u5c3e\u7684\u6587\u4ef6\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u4e03\u3001\u8ffd\u52a0\u64cd\u4f5c<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6709\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u5411\u5df2\u6709\u7684\u5f52\u6863\u6587\u4ef6\u4e2d\u6dfb\u52a0\u65b0\u7684\u6587\u4ef6\u6216\u76ee\u5f55\u3002\u6b64\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528--append\u9009\u9879\u6765\u8fdb\u884c\u8ffd\u52a0\u64cd\u4f5c\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u8ffd\u52a0\u793a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar -rvf test.tar file3\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0a\u8ff0\u547d\u4ee4\u5c06file3\u6dfb\u52a0\u5230test.tar\u5f52\u6863\u6587\u4ef6\u4e2d\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><b>\u516b\u3001\u603b\u7ed3<\/b><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>tar\u547d\u4ee4\u662fLinux\u7cfb\u7edf\u4e0b\u5e38\u7528\u7684\u6253\u5305\u548c\u538b\u7f29\u5de5\u5177\u4e4b\u4e00\uff0c\u638c\u63e1\u5176\u57fa\u672c\u7528\u6cd5\u5bf9\u4e8e\u65e5\u5e38\u5de5\u4f5c\u975e\u5e38\u91cd\u8981\u3002\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86tar\u547d\u4ee4\u7684\u57fa\u672c\u8bed\u6cd5\u3001\u6253\u5305\u3001\u538b\u7f29\u3001\u89e3\u5305\u3001\u6392\u9664\u3001\u8ffd\u52a0\u7b49\u64cd\u4f5c\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdLinux\u6253\u5305\u547d\u4ee4tar\u7684\u76f8\u5173\u77e5\u8bc6\u548c\u6280\u5de7\uff0c\u5e2e\u52a9\u5927\u5bb6\u66f4\u597d\u5730\u4f7f\u7528\u8be5\u547d\u4ee4\u3002\u4e00\u3001tar\u547d\u4ee4\u7b80\u4ecbtar\u547d\u4ee4\u7684\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\uff1a\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u7528\u7684tar\u547d\u4ee4\u793a\u4f8b\uff1atar\u5f52\u6863\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u89e3\u5305\u5230\u5f53\u524d\u76ee\u5f55\u4e0b\u3002\u4e0a\u8ff0\u547d\u4ee4\u5c06dir\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u6253\u5305\u6210test.\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86tar\u547d\u4ee4\u7684\u57fa\u672c\u8bed\u6cd5\u3001\u6253\u5305\u3001\u538b\u7f29\u3001\u89e3\u5305\u3001\u6392\u9664\u3001\u8ffd\u52a0\u7b49\u64cd\u4f5c\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[23,111,112],"class_list":["post-15018","post","type-post","status-publish","format-standard","hentry","category-knowledge","tag-lxt","tag-t","tag-tdb"],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/15018","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=15018"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/15018\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=15018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=15018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=15018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}