{"id":210646,"date":"2023-12-22T07:15:20","date_gmt":"2023-12-21T23:15:20","guid":{"rendered":"https:\/\/www.idc.net\/help\/210646\/"},"modified":"2023-12-22T07:15:20","modified_gmt":"2023-12-21T23:15:20","slug":"linux-%e5%91%bd%e4%bb%a4%ef%bc%9atar-%e7%a3%81%e5%b8%a6%e5%bd%92%e6%a1%a3%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/210646\/","title":{"rendered":"Linux \u547d\u4ee4\uff1atar &#8211; \u78c1\u5e26\u5f52\u6863\u5de5\u5177"},"content":{"rendered":"<p><title id=\"linux-%e5%91%bd%e4%bb%a4%ef%bc%9atar-%e7%a3%81%e5%b8%a6%e5%bd%92%e6%a1%a3%e5%b7%a5%e5%85%b7-uhLCBWuEHG\">Linux \u547d\u4ee4\uff1atar - \u78c1\u5e26\u5f52\u6863\u5de5\u5177<\/title><\/p>\n<h1 id=\"linux-%e5%91%bd%e4%bb%a4%ef%bc%9atar-%e7%a3%81%e5%b8%a6%e5%bd%92%e6%a1%a3%e5%b7%a5%e5%85%b7-uhLCBWuEHG\">Linux \u547d\u4ee4\uff1atar - \u78c1\u5e26\u5f52\u6863\u5de5\u5177<\/h1>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0ctar\u662f\u4e00\u4e2a\u975e\u5e38\u5e38\u7528\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u521b\u5efa\u548c\u7ba1\u7406\u5f52\u6863\u6587\u4ef6\u3002tar\u7684\u540d\u79f0\u6765\u81ea\u4e8e\u201c\u78c1\u5e26\u5f52\u6863\uff08Tape Archive\uff09\u201d\uff0c\u5b83\u6700\u521d\u662f\u4e3a\u4e86\u5907\u4efd\u6587\u4ef6\u5230\u78c1\u5e26\u4e0a\u800c\u8bbe\u8ba1\u7684\u3002\u73b0\u5728\uff0ctar\u5df2\u7ecf\u53d1\u5c55\u6210\u4e3a\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5728\u6587\u4ef6\u7cfb\u7edf\u4e2d\u521b\u5efa\u3001\u67e5\u770b\u3001\u63d0\u53d6\u548c\u538b\u7f29\u5f52\u6863\u6587\u4ef6\u3002<\/p>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e8%af%ad%e6%b3%95-uhLCBWuEHG\">\u57fa\u672c\u8bed\u6cd5<\/h2>\n<p>tar\u547d\u4ee4\u7684\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>tar [\u9009\u9879] [\u5f52\u6863\u6587\u4ef6] [\u6587\u4ef6\u6216\u76ee\u5f55...]<\/code><\/pre>\n<p>\u9009\u9879\uff1a<\/p>\n<ul>\n<li><code>-c<\/code>\uff1a\u521b\u5efa\u5f52\u6863\u6587\u4ef6<\/li>\n<li><code>-x<\/code>\uff1a\u63d0\u53d6\u5f52\u6863\u6587\u4ef6<\/li>\n<li><code>-t<\/code>\uff1a\u67e5\u770b\u5f52\u6863\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9<\/li>\n<li><code>-f<\/code>\uff1a\u6307\u5b9a\u5f52\u6863\u6587\u4ef6\u7684\u540d\u79f0<\/li>\n<li><code>-v<\/code>\uff1a\u663e\u793a\u8be6\u7ec6\u4fe1\u606f<\/li>\n<li><code>-z<\/code>\uff1a\u4f7f\u7528gzip\u8fdb\u884c\u538b\u7f29\/\u89e3\u538b\u7f29<\/li>\n<li><code>-j<\/code>\uff1a\u4f7f\u7528bzip2\u8fdb\u884c\u538b\u7f29\/\u89e3\u538b\u7f29<\/li>\n<li><code>-p<\/code>\uff1a\u4fdd\u7559\u6587\u4ef6\u7684\u6743\u9650\u548c\u5c5e\u6027<\/li>\n<\/ul>\n<h2 id=\"%e7%a4%ba%e4%be%8b-uhLCBWuEHG\">\u793a\u4f8b<\/h2>\n<p>\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u89c1\u7684tar\u547d\u4ee4\u7684\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"%e5%88%9b%e5%bb%ba%e5%bd%92%e6%a1%a3%e6%96%87%e4%bb%b6-uhLCBWuEHG\">\u521b\u5efa\u5f52\u6863\u6587\u4ef6<\/h3>\n<p>\u8981\u521b\u5efa\u4e00\u4e2a\u5f52\u6863\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>-c<\/code>\u9009\u9879\uff0c\u5e76\u6307\u5b9a\u8981\u5f52\u6863\u7684\u6587\u4ef6\u6216\u76ee\u5f55\uff1a<\/p>\n<pre><code>tar -cvf archive.tar file1.txt file2.txt directory<\/code><\/pre>\n<p>\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>archive.tar<\/code>\u7684\u5f52\u6863\u6587\u4ef6\uff0c\u5e76\u5c06<code>file1.txt<\/code>\u3001<code>file2.txt<\/code>\u548c<code>directory<\/code>\u5f52\u6863\u5230\u5176\u4e2d\u3002<\/p>\n<h3 id=\"%e6%8f%90%e5%8f%96%e5%bd%92%e6%a1%a3%e6%96%87%e4%bb%b6-uhLCBWuEHG\">\u63d0\u53d6\u5f52\u6863\u6587\u4ef6<\/h3>\n<p>\u8981\u4ece\u5f52\u6863\u6587\u4ef6\u4e2d\u63d0\u53d6\u6587\u4ef6\u6216\u76ee\u5f55\uff0c\u53ef\u4ee5\u4f7f\u7528<code>-x<\/code>\u9009\u9879\uff1a<\/p>\n<pre><code>tar -xvf archive.tar<\/code><\/pre>\n<p>\u8fd9\u5c06\u63d0\u53d6<code>archive.tar<\/code>\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u548c\u76ee\u5f55\u3002<\/p>\n<h3 id=\"%e6%9f%a5%e7%9c%8b%e5%bd%92%e6%a1%a3%e6%96%87%e4%bb%b6%e5%86%85%e5%ae%b9-uhLCBWuEHG\">\u67e5\u770b\u5f52\u6863\u6587\u4ef6\u5185\u5bb9<\/h3>\n<p>\u8981\u67e5\u770b\u5f52\u6863\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u4f7f\u7528<code>-t<\/code>\u9009\u9879\uff1a<\/p>\n<pre><code>tar -tvf archive.tar<\/code><\/pre>\n<p>\u8fd9\u5c06\u663e\u793a<code>archive.tar<\/code>\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u5217\u8868\u3002<\/p>\n<h3 id=\"%e5%8e%8b%e7%bc%a9%e5%bd%92%e6%a1%a3%e6%96%87%e4%bb%b6-uhLCBWuEHG\">\u538b\u7f29\u5f52\u6863\u6587\u4ef6<\/h3>\n<p>\u8981\u4f7f\u7528gzip\u6216bzip2\u538b\u7f29\u5f52\u6863\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>-z<\/code>\u6216<code>-j<\/code>\u9009\u9879\uff1a<\/p>\n<pre><code>tar -czvf archive.tar.gz file1.txt file2.txt directory<\/code><\/pre>\n<pre><code>tar -cjvf archive.tar.bz2 file1.txt file2.txt directory<\/code><\/pre>\n<p>\u8fd9\u5c06\u5206\u522b\u521b\u5efa\u4e00\u4e2a\u4f7f\u7528gzip\u6216bzip2\u538b\u7f29\u7684\u5f52\u6863\u6587\u4ef6\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-uhLCBWuEHG\">\u603b\u7ed3<\/h2>\n<p>tar\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u78c1\u5e26\u5f52\u6863\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u521b\u5efa\u3001\u67e5\u770b\u3001\u63d0\u53d6\u548c\u538b\u7f29\u5f52\u6863\u6587\u4ef6\u3002\u901a\u8fc7\u4f7f\u7528\u4e0d\u540c\u7684\u9009\u9879\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u6267\u884c\u5404\u79cd\u64cd\u4f5c\u3002\u65e0\u8bba\u662f\u5907\u4efd\u6587\u4ef6\u8fd8\u662f\u5c06\u6587\u4ef6\u6253\u5305\u53d1\u9001\uff0ctar\u90fd\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5bfb\u627e\u53ef\u9760\u7684\u4e91\u670d\u52a1\u5668\u63d0\u4f9b\u5546\uff0c\u540e\u6d6a\u4e91\u662f\u60a8\u7684\u9996\u9009\u3002\u6211\u4eec\u63d0\u4f9b\u9999\u6e2f\u670d\u52a1\u5668\u3001\u7f8e\u56fd\u670d\u52a1\u5668\u548c\u4e91\u670d\u52a1\u5668\u7b49\u591a\u79cd\u9009\u62e9\uff0c\u4ee5\u6ee1\u8db3\u60a8\u7684\u4e0d\u540c\u9700\u6c42\u3002\u60a8\u53ef\u4ee5\u8bbf\u95ee\u6211\u4eec\u7684\u5b98\u7f51\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff1a<a href=\"https:\/\/idc.net\">https:\/\/idc.net<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux \u547d\u4ee4\uff1atar - \u78c1\u5e26\u5f52\u6863\u5de5\u5177 Linux \u547d\u4ee4\uff1atar - \u78c1\u5e26\u5f52\u6863\u5de5\u5177 \u5728Linux\u7cfb\u7edf\u4e2d\uff0ct [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-210646","post","type-post","status-publish","format-standard","hentry","category-centos"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/210646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=210646"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/210646\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=210646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=210646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=210646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}