{"id":13029,"date":"2024-01-22T13:23:48","date_gmt":"2024-01-22T05:23:48","guid":{"rendered":"https:\/\/blog.hoyo.idv.tw\/?p=13029"},"modified":"2024-10-28T13:39:12","modified_gmt":"2024-10-28T05:39:12","slug":"s3-%e7%9c%81%e7%94%a8-s3cmd-%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=13029","title":{"rendered":"S3 - \u7528 s3cmd \u7ba1\u7406"},"content":{"rendered":"<p>--<\/p>\n<h2>\u524d\u8a00<\/h2>\n<p>\u672c\u4f86\u5c0d\u65bc S3 \u7684\u7ba1\u7406\u90fd\u662f\u4f7f\u7528 S3 Browser\uff0c\u5f8c\u4f86\u56e0\u70ba\u60f3\u8981\u77e5\u9053\u5168\u90e8\u4f7f\u7528\u4e86\u591a\u5c11\u7a7a\u9593\uff0c\u56e0\u70ba\u6a94\u6848\u6578\u592a\u591a S3 Browser \u4e00\u76f4\u7121\u6cd5\u6b63\u5e38\u904b\u884c\uff0c\u624d\u627e\u5230 s3cmd<\/p>\n<p>--<\/p>\n<h2>\u5b89\u88dd<\/h2>\n<ul>\n<li><a href=\"https:\/\/tecadmin.net\/install-s3cmd-manage-amazon-s3-buckets\/\" target=\"_blank\" rel=\"noopener\">How To Install s3cmd in Linux and Manage S3 Buckets - TecAdmin<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">sudo apt-get install s3cmd<\/pre>\n<p>--<\/p>\n<h2>\u53c3\u8003\u8cc7\u6e90<\/h2>\n<ul>\n<li><a href=\"https:\/\/s3tools.org\/usage\" target=\"_blank\" rel=\"noopener\">Amazon S3 Tools: S3cmd Usage<\/a><\/li>\n<\/ul>\n<p>--<\/p>\n<h2>\u5bb9\u91cf<\/h2>\n<ul>\n<li><a href=\"https:\/\/coderwall.com\/p\/jtlxmg\/human-readable-size-on-s3cmd\" target=\"_blank\" rel=\"noopener\">Human readable size on s3cmd (Example) (coderwall.com)<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">s3cmd du -H<\/pre>\n<p>du \u53ea\u80fd\u5217\u51fa bucket \u7684\u7e3d\u5bb9\u91cf\uff0c\u4e0d\u80fd\u6307\u5b9a\u5230 object\uff0c\u52a0\u4e0a -H \u53ef\u4ee5\u986f\u793a\u53ef\u95b1\u8b80\u7684\u683c\u5f0f\uff0c\u9810\u8a2d\u5217\u51fa\u5168\u90e8\u7684 bucket \u6700\u5f8c\u6709\u52a0\u7e3d\u5bb9\u91cf<\/p>\n<p>--<\/p>\n<h2>\u5217\u51fa\u4e0b\u5c64\u6a94\u6848<\/h2>\n<ul>\n<li><a href=\"https:\/\/blog.csdn.net\/wzj_110\/article\/details\/86669426\" target=\"_blank\" rel=\"noopener\">LInux shell\u4e4b(for in \u7528\u6cd5\u603b\u7ed3)_linux for i in-CSDN\u535a\u5ba2<\/a><\/li>\n<\/ul>\n<p>ls \u53ea\u80fd\u5217\u51fa [s3:\/\/BUCKET[\/PREFIX]]\uff0c\u60f3\u8981\u5f80\u4e0b\u4e00\u5c64\u6216\u66f4\u5f80\u4e0b\u5c31\u5fc5\u9808\u81ea\u5df1\u8655\u7406<\/p>\n<p>\u5982\u679c\u525b\u597d\u53ea\u9700\u8981\u591a\u5f80\u4e0b\u4e00\u5c64\u53ef\u4ee5\u53c3\u8003\u4ee5\u4e0b shell<\/p>\n<pre class=\"lang:default decode:true \">#!\/bin\/bash\r\n\r\nline=`s3cmd --config=\/root\/.s3cfg_upad12 ls s3:\/\/upad-cloud\/videos\/ | awk '{print $2}'`\r\n\r\nfor one in $line\r\n    do\r\n        s3cmd --config=\/root\/.s3cfg_upad12 ls $one &gt;&gt; upad12.log\r\n    done<\/pre>\n<p>--<\/p>\n<h2>\u5207\u63db\u8a2d\u5b9a\u6a94<\/h2>\n<pre class=\"lang:default decode:true\">  -c FILE, --config=FILE\r\n      Config file name. Defaults to $HOME\/.s3cfg<\/pre>\n<p>\u4f7f\u7528 -c \u53c3\u6578\u53ef\u4ee5\u6307\u5b9a\u8a2d\u5b9a\u6a94\uff0c\u9810\u8a2d\u5728 ~\/.s3cfg\uff0c\u5982\u679c\u6709\u591a\u500b S3 \u540c\u6642\u4f7f\u7528\u53ef\u4ee5\u8907\u88fd s3cfg \u4fee\u6539\u5f8c\u4f7f\u7528<\/p>\n<p>\u7bc4\u4f8b\uff1a<\/p>\n<pre class=\"lang:default decode:true\">s3cmd --config=.s3cfg_upad12 du -H<\/pre>\n<p>--<\/p>\n<h2>Hicloud \u914d\u7f6e<\/h2>\n<ul>\n<li><a href=\"https:\/\/userportal.hicloud.hinet.net\/cloud\/document\/files\/hicloud-S3-QuickStart.pdf\" target=\"_blank\" rel=\"noopener\">\u4e2d\u83ef\u96fb\u4fe1 hicloud S3 \u96f2\u5132\u5b58 Quick Start Guide API Version 2012\/12\/27<\/a><\/li>\n<\/ul>\n<p>\u4f5c\u70ba\u96f2\u7aef\u670d\u52d9\u908a\u7de3\u4eba\u5ba2\u6236\uff0c\u6587\u4ef6\u662f\u5341\u5e74\u524d\u7684\uff0c\u6240\u4ee5\u7121\u6cd5\u4f7f\u7528\u9084\u8981\u7533\u544a\u624d\u80fd\u77e5\u9053\u554f\u984c\u4ee5\u53ca\u4f7f\u7528<\/p>\n<pre class=\"lang:default decode:true\">[default]\r\naccess_key = \u4f60\u7684 Access Key\r\nsecret_key = \u4f60\u7684 Secret Key\r\n\r\nbucket_location = us-east-1\r\nhost_base = s3.hicloud.net.tw\r\nhost_bucket = %(bucket)s.s3.hicloud.net.tw\r\n<\/pre>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"13029\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;2,065&nbsp;total views, &nbsp;2&nbsp;views today<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>-- \u524d\u8a00 \u672c\u4f86\u5c0d\u65bc S3 \u7684...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"13029\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;2,065&nbsp;total views, &nbsp;2&nbsp;views today<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[31],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/13029"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13029"}],"version-history":[{"count":8,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/13029\/revisions"}],"predecessor-version":[{"id":13587,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/13029\/revisions\/13587"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}