{"id":156505,"date":"2019-09-07T10:22:37","date_gmt":"2019-09-07T02:22:37","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=156505"},"modified":"2019-08-26T09:23:44","modified_gmt":"2019-08-26T01:23:44","slug":"linux-unzip","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-unzip.html","title":{"rendered":"\u6559\u4f60\u5982\u4f55\u5728 Linux \u4e2d\u4f7f\u7528 unzip \u89e3\u538b\u7f29\u6587\u4ef6"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nZIP \u662f\u6700\u5e7f\u6cdb\u4f7f\u7528\u7684\u5f52\u6863\u6587\u4ef6\u683c\u5f0f\uff0c\u652f\u6301\u65e0\u635f\u6570\u636e\u538b\u7f29\u3002 ZIP \u6587\u4ef6\u662f\u5305\u542b\u4e00\u4e2a\u6216\u591a\u4e2a\u538b\u7f29\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6570\u636e\u5bb9\u5668\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u4f7f\u7528 unzip \u547d\u4ee4\u901a\u8fc7\u547d\u4ee4\u884c\u89e3\u538b\u7f29 Linux \u7cfb\u7edf\u4e2d\u7684\u6587\u4ef6\u3002<\/p>\n

\u4ec0\u4e48\u662f unzip \uff1f<\/strong><\/span><\/div>\n

Unzip \u662f\u4e00\u4e2a\u5b9e\u7528\u7a0b\u5e8f\uff0c\u53ef\u5e2e\u52a9\u60a8\u5217\u51fa\uff0c\u6d4b\u8bd5\u548c\u63d0\u53d6\u538b\u7f29\u7684 ZIP \u5b58\u6863\u3002<\/p>\n

\u5b89\u88c5\u89e3\u538b\u7f29<\/strong><\/span><\/div>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5927\u591a\u6570 Linux \u53d1\u884c\u7248\u4e2d\u90fd\u6ca1\u6709\u5b89\u88c5 Unzip \uff0c\u4f46\u60a8\u53ef\u4ee5\u4f7f\u7528\u53d1\u884c\u7248\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8f7b\u677e\u5b89\u88c5\u5b83\u3002
\n\u5728 Ubuntu \u548c Debian \u4e0a\u5b89\u88c5\u89e3\u538b\u7f29<\/p>\n

sudo apt install unzip<\/pre>\n

\u5728 CentOS \u548c Fedora \u4e0a\u5b89\u88c5\u89e3\u538b\u7f29<\/p>\n

sudo yum install unzip<\/pre>\n
\u5982\u4f55\u89e3\u538b\u7f29 ZIP \u6587\u4ef6<\/strong><\/span><\/div>\n

\u5728\u6ca1\u6709\u4efb\u4f55\u9009\u9879\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\u5b83\u662f\u6700\u7b80\u5355\u7684\u5f62\u5f0f\uff0c\u8be5 unzip \u547d\u4ee4\u5c06\u4ece\u6307\u5b9a\u7684 ZIP \u5b58\u6863\u4e2d\u63d0\u53d6\u6240\u6709\u6587\u4ef6\u5230\u5f53\u524d\u76ee\u5f55\u3002<\/p>\n

unzip filename.zip<\/pre>\n

\u4e3a\u4e86\u80fd\u591f\u5728\u7279\u5b9a\u76ee\u5f55\u4e2d\u63d0\u53d6 ZIP \u5b58\u6863\uff0c\u7528\u6237\u9700\u8981\u5bf9\u8be5\u76ee\u5f55\u5177\u6709\u5199\u5165\u6743\u9650\u3002<\/p>\n

ZIP \u6587\u4ef6\u4e0d\u652f\u6301 Linux \u6837\u5f0f\u7684\u6240\u6709\u6743\u4fe1\u606f\uff0c\u5e76\u4e14\u6240\u6709\u63d0\u53d6\u7684\u6587\u4ef6\u5c06\u7531\u8fd0\u884c\u8be5\u547d\u4ee4\u7684\u7528\u6237\u62e5\u6709\u3002<\/p>\n

\u4f8b\u5982\uff0c\u5047\u8bbe\u60a8\u4e0b\u8f7d\u4e86 WordPress \u5b89\u88c5\u00a0ZIP\u6587\u4ef6(https:\/\/wordpress.org\/latest.zip)\u3002\u8981\u5c06\u6b64\u6587\u4ef6\u89e3\u538b\u7f29\u5230\u5f53\u524d\u76ee\u5f55\uff0c\u53ea\u9700\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n
unzip latest.zip<\/pre>\n<\/div>\n
\u5982\u4f55\u6291\u5236 unzip \u547d\u4ee4\u7684\u8f93\u51fa<\/strong><\/span><\/div>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c unzip \u547d\u4ee4\u6253\u5370\u5b83\u63d0\u53d6\u7684\u6240\u6709\u6587\u4ef6\u7684\u540d\u79f0\u4ee5\u53ca\u63d0\u53d6\u5b8c\u6210\u65f6\u7684\u6458\u8981\u3002<\/p>\n

\u4f7f\u7528 -q \u9009\u9879\u53ef\u7981\u6b62\u6253\u5370\u8fd9\u4e9b\u6d88\u606f\u3002<\/p>\n

\n
unzip -q filename.zip<\/pre>\n<\/div>\n
\u5982\u4f55\u5c06 ZIP \u6587\u4ef6\u89e3\u538b\u7f29\u5230\u5176\u4ed6\u76ee\u5f55<\/strong><\/span><\/div>\n

\u8981\u5c06 ZIP \u6587\u4ef6\u89e3\u538b\u7f29\u5230\u4e0e\u5f53\u524d\u76ee\u5f55\u4e0d\u540c\u7684\u76ee\u5f55\u4e2d\uff0c\u8bf7\u4f7f\u7528\u8be5 -d \u9009\u9879\u3002<\/p>\n

\n
unzip filename.zip -d \/path\/to\/directory<\/pre>\n<\/div>\n

\u4f8b\u5982\uff0c\u8981\u5c06 WordPress \u5b58\u6863\u89e3\u538b\u7f29 latest.zip \u5230 \/var\/www\/ \u76ee\u5f55\uff0c\u60a8\u5c06\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n
sudo unzip latest.zip -d \/var\/www<\/pre>\n<\/div>\n

\u5728\u4e0a\u9762\u7684\u547d\u4ee4\u4e2d\u6211\u4eec\u4f7f\u7528\u4e86 sudo \uff0c\u56e0\u4e3a\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u767b\u5f55\u7684\u7528\u6237\u6ca1\u6709\u5bf9 \/var\/www \u76ee\u5f55\u7684\u5199\u6743\u9650\u3002\u5f53\u4f7f\u7528 sudo \u89e3\u538b\u7f29 ZIP \u6587\u4ef6\u65f6\uff0c\u63d0\u53d6\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u5c06\u7531\u7528\u6237 root \u62e5\u6709\u3002<\/p>\n

\u5982\u4f55\u89e3\u538b\u7f29\u53d7\u5bc6\u7801\u4fdd\u62a4\u7684 ZIP \u6587\u4ef6<\/strong><\/span><\/div>\n

\u8981\u89e3\u538b\u7f29\u53d7\u5bc6\u7801\u4fdd\u62a4\u7684\u6587\u4ef6\uff0c\u8bf7\u4f7f\u7528 -P \u9009\u9879\u540e\u8ddf\u5bc6\u7801\u3002<\/p>\n

\n
unzip -P PasswOrd filename.zip<\/pre>\n<\/div>\n
\u89e3\u538b\u7f29 ZIP \u6587\u4ef6\u65f6\u5982\u4f55\u6392\u9664\u6587\u4ef6<\/strong><\/span><\/div>\n

\u5982\u679c\u8981\u4ece ZIP \u5b58\u6863\u4e2d\u63d0\u53d6\u9664\u4e00\u4e2a\u6587\u4ef6\u4ee5\u5916\u7684\u6240\u6709\u6587\u4ef6\uff0c\u8bf7\u4f7f\u7528\u8be5 -x \u9009\u9879\u3002<\/p>\n

\n
unzip filename.zip -x file-to-exclude<\/pre>\n<\/div>\n

\u5728\u4ee5\u4e0b\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4ece ZIP \u5b58\u6863\u4e2d\u63d0\u53d6\u9664 .git \u76ee\u5f55\u4e4b\u5916\u7684\u6240\u6709\u6587\u4ef6\u548c\u76ee\u5f55\uff1a<\/p>\n

\n
unzip filename.zip -x \"*.git\/*\"<\/pre>\n<\/div>\n
\u4f7f\u7528\u89e3\u538b\u7f29\u65f6\u5982\u4f55\u8986\u76d6\u73b0\u6709\u6587\u4ef6<\/strong><\/span><\/div>\n

\u5047\u8bbe\u60a8\u5df2\u7ecf\u89e3\u538b\u7f29\u4e86 ZIP \u6587\u4ef6\uff0c\u5f53\u60a8\u518d\u6b21\u8fd0\u884c\u76f8\u540c\u7684\u547d\u4ee4\u3002<\/p>\n

\n
unzip latest.zip<\/pre>\n<\/div>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c Unzip \u4f1a\u8be2\u95ee\u60a8\u662f\u8981\u8986\u76d6\u5f53\u524d\u6587\u4ef6\uff0c\u8986\u76d6\u6240\u6709\u6587\u4ef6\uff0c\u8df3\u8fc7\u5f53\u524d\u6587\u4ef6\u7684\u63d0\u53d6\uff0c\u8df3\u8fc7\u63d0\u53d6\u6240\u6709\u6587\u4ef6\uff0c\u8fd8\u662f\u91cd\u547d\u540d\u5f53\u524d\u6587\u4ef6\u3002<\/p>\n

\n
Archive:  latest.zip\r\nreplace wordpress\/xmlrpc.php? [y]es, [n]o, [A]ll, [N]one, [r]ename:<\/pre>\n<\/div>\n

\u5982\u679c\u8981\u5728\u4e0d\u63d0\u793a\u7684\u60c5\u51b5\u4e0b\u8986\u76d6\u73b0\u6709\u6587\u4ef6\uff0c\u8bf7\u4f7f\u7528 -o \u9009\u9879\uff1a<\/p>\n

\n
unzip -o filename.zip<\/pre>\n<\/div>\n

\u8bf7\u8c28\u614e\u4f7f\u7528\u6b64\u9009\u9879\u3002\u6587\u4ef6\u5c06\u88ab\u8986\u76d6\uff0c\u5982\u679c\u60a8\u5bf9\u6587\u4ef6\u8fdb\u884c\u4e86\u4efb\u4f55\u66f4\u6539\uff0c\u5219\u66f4\u6539\u5c06\u4e22\u5931\u3002<\/p>\n

\u5982\u4f55\u5728\u4e0d\u8986\u76d6\u73b0\u6709\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u89e3\u538b\u7f29 ZIP \u6587\u4ef6<\/strong><\/span><\/div>\n

\u5047\u8bbe\u60a8\u5df2\u7ecf\u89e3\u538b\u7f29\u4e86\u4e00\u4e2a ZIP \u6587\u4ef6\uff0c\u5e76\u4e14\u60a8\u5bf9\u67d0\u4e9b\u6587\u4ef6\u8fdb\u884c\u4e86\u66f4\u6539\uff0c\u4f46\u662f\u60a8\u4e0d\u5c0f\u5fc3\u5220\u9664\u4e86\u4e00\u4e9b\u6587\u4ef6\u3002\u60a8\u5e0c\u671b\u4fdd\u7559\u66f4\u6539\u5e76\u4ece ZIP \u5b58\u6863\u4e2d\u8fd8\u539f\u5df2\u5220\u9664\u7684\u6587\u4ef6\u3002<\/p>\n

\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u60a8\u8981\u4f7f\u7528 -n \u9009\u9879\u6765\u8df3\u8fc7\u5df2\u5b58\u5728\u7684\u6587\u4ef6\u7684\u63d0\u53d6\u3002<\/p>\n

\n
unzip -n filename.zip<\/pre>\n<\/div>\n
\u5982\u4f55\u89e3\u538b\u7f29\u591a\u4e2a ZIP \u6587\u4ef6<\/strong><\/span><\/div>\n

\u5982\u679c\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u4e2d\u6709\u591a\u4e2a ZIP \u6587\u4ef6\uff0c\u5219\u53ea\u9700\u4f7f\u7528\u4e00\u4e2a\u547d\u4ee4\u5373\u53ef\u89e3\u538b\u7f29\u6240\u6709\u6587\u4ef6\uff1a<\/p>\n

\n
unzip '*.zip'<\/pre>\n<\/div>\n

\u6ce8\u610f *.zip \u5468\u56f4\u7684\u5355\u5f15\u53f7\u3002\u5982\u679c\u60a8\u5fd8\u8bb0\u5f15\u7528\u53c2\u6570\uff0c shell \u5c06\u5c55\u5f00\u901a\u914d\u7b26\uff0c\u60a8\u5c06\u6536\u5230\u9519\u8bef\u3002<\/p>\n

\u5982\u4f55\u5217\u51fa Zip \u6587\u4ef6\u7684\u5185\u5bb9<\/strong><\/span><\/div>\n

\u8981\u5217\u51fa ZIP \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u8bf7\u4f7f\u7528 -l \u9009\u9879\u3002<\/p>\n

\n
unzip -l filename.zip<\/pre>\n<\/div>\n

\u5728\u6211\u4eec\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5217\u51fa\u6240\u6709 WordPress \u5b89\u88c5\u6587\u4ef6\uff1a<\/p>\n

\n
unzip -l latest.zip<\/pre>\n<\/div>\n

\u8f93\u51fa\u5c06\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

\n
Archive:  latest.zip\r\n  Length      Date    Time    Name\r\n---------  ---------- -----   ----\r\n        0  2018-08-02 22:39   wordpress\/\r\n     3065  2016-08-31 18:31   wordpress\/xmlrpc.php\r\n      364  2015-12-19 12:20   wordpress\/wp-blog-header.php\r\n     7415  2018-03-18 17:13   wordpress\/readme.html\r\n...\r\n...\r\n    21323  2018-03-09 01:15   wordpress\/wp-admin\/themes.php\r\n     8353  2017-09-10 18:20   wordpress\/wp-admin\/options-reading.php\r\n     4620  2017-10-24 00:12   wordpress\/wp-trackback.php\r\n     1889  2018-05-03 00:11   wordpress\/wp-comments-post.php\r\n---------                     -------\r\n 27271400                     1648 files<\/pre>\n<\/div>\n
\u7ed3\u8bba<\/strong><\/div>\n

\u60a8\u5df2\u7ecf\u5b66\u4e60\u4e86\u5982\u4f55\u89e3\u538b\u7f29 ZIP \u6587\u4ef6\u548c\u6700\u5e38\u89c1\u7684\u89e3\u538b\u7f29\u9009\u9879\u3002\u8981\u5728 Linux \u7cfb\u7edf\u4e0a\u521b\u5efa ZIP \u5b58\u6863\uff0c\u60a8\u9700\u8981\u4f7f\u7528 zip \u547d\u4ee4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u4f7f\u7528 unzip \u547d\u4ee4\u901a\u8fc7\u547d\u4ee4\u884c\u89e3\u538b\u7f29 Linux \u7cfb\u7edf\u4e2d\u7684\u6587\u4ef6\u3002 Unzip […]<\/p>\n","protected":false},"author":63,"featured_media":156510,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-156505","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\/156505","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=156505"}],"version-history":[{"count":11,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156505\/revisions"}],"predecessor-version":[{"id":157072,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/156505\/revisions\/157072"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/156510"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=156505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=156505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=156505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}