{"id":394,"date":"2009-06-11T11:42:28","date_gmt":"2009-06-11T16:42:28","guid":{"rendered":"http:\/\/www.gamescheat.ca\/?p=394"},"modified":"2019-09-04T19:57:40","modified_gmt":"2019-09-05T00:57:40","slug":"how-to-backup-and-compress-a-folder-in-one-step-using-tar-and-gzip","status":"publish","type":"post","link":"http:\/\/www.gamescheat.ca\/?p=394","title":{"rendered":"How to backup and compress a folder in one step, using tar and gzip."},"content":{"rendered":"<div style=\"float: left;\"><div style=\"margin: 15px 15px 15px 15px\";><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"pub-3319935785736004\";\ngoogle_alternate_color = \"FFFFFF\";\ngoogle_ad_width = 234;\ngoogle_ad_height = 60;\ngoogle_ad_format = \"234x60_as\";\ngoogle_ad_type = \"text_image\";\ngoogle_ad_channel =\"\";\ngoogle_color_border = \"cccccc\";\ngoogle_color_link = \"cc0000\";\ngoogle_color_bg = \"ffffff\";\ngoogle_color_text = \"000000\";\ngoogle_color_url = \"008000\";\n\/\/--><\/script>\n<script type=\"text\/javascript\"\n  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/div><\/div><p>If disk space is limited on your Linux or Unix server and you wish to backup a folder or file that is larger than <\/p>\n<p>the available free space.  Then creating a compressed archive in one step may be the only option, not to mention <\/p>\n<p>that it is also faster.<\/p>\n<p><strong>tar cf \u2013 folder_name | gzip -c > .\/andrewlin\/folder_name.tgz<\/strong><\/p>\n<p>This will backup the folder isp to standard output which is represented by the \u2013 (hyphen).<br \/>\nThe \u2018|\u2019 (pipe) will redirect the result to the commands following it.<br \/>\ngzip compresses the contents in standard input, represented with \u2013 (hyphen).<br \/>\nThe result of gzip is redirected to a file folder_name.tgz, located in the folder andrewlin.<\/p>\n<p>You can also capture the contents of the standard output  to your workstation across the network. Meaning that your <\/p>\n<p>can ssh to the remote server, create the archive, compress it, then save the file onto the computer you ssh from.  <\/p>\n<p>This method helps if you want to store the backup on a different server.  Below is the command to do that.<\/p>\n<p><strong>ssh user@remotemachine \u201ccd \/path;tar -cf \u2013 target | gzip -c\u201d > \/path\/target.tgz<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If disk space is limited on your Linux or Unix server and you wish to backup a folder or file that is larger than the available free space. Then creating a compressed archive in one step may be the only&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.gamescheat.ca\/?p=394\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[55,35],"_links":{"self":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/394"}],"collection":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=394"}],"version-history":[{"count":2,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/394\/revisions"}],"predecessor-version":[{"id":995,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/394\/revisions\/995"}],"wp:attachment":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=394"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}