{"id":212,"date":"2016-01-12T15:33:13","date_gmt":"2016-01-12T15:33:13","guid":{"rendered":"http:\/\/wp-p3d2tsa2xh.pairsite.com\/?p=212"},"modified":"2019-02-06T13:54:44","modified_gmt":"2019-02-06T18:54:44","slug":"paircloud-gnu-tar","status":"publish","type":"ht_kb","link":"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/","title":{"rendered":"Using GNU Tar"},"content":{"rendered":"<p class=\"p1\"><span class=\"s1\"><a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/shared-hosting\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">Shared<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/vps\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">VPS<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/qs-dedicated\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px; font-weight:bold; border-radius:3px;\">Dedicated<\/p><\/a>\u00a0<a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional-plus\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional Plus<\/p><\/a><\/span><\/p>\n<p>The <code>tar<\/code> command is used to join many files together into one, and optionally compress them. The process is totally reversible. This is used for archival purposes, backups or for sending on to others.<\/p>\n<h3 class=\"kb\">Creating a Tar file<\/h3>\n<p>The <code>tar<\/code> command has two main options relating to creating an archive. These are <code>-c<\/code> and <code>-z<\/code>. The format of a <code>tar<\/code> command is <code>tar [options] file\/directory<\/code>. The <code>-c<\/code> option means <strong>create<\/strong> and the <code>-z<\/code> option mean <strong>gzip<\/strong> the resulting file. The other option we will look at here is the <code>-f<\/code> option, which specifies the output <strong>file<\/strong>. Putting all this together the most common use of the <code>tar<\/code> command to create an archive would be <code>tar -czf output.tar.gz directory<\/code>. This command will tar all the files together and then gzip them.<\/p>\n<h3 class=\"kb\">Extracting a Tar file<\/h3>\n<p>To extract a tar file you would use the <code>-x<\/code> option. You also need to specify the file to extract using the <code>-f<\/code> option. If the archive has a <strong>.gz<\/strong> extension you will also need to use the <code>-z<\/code> option to let <code>tar<\/code> know to unzip the contents. The final option that you may find useful is <code>-v<\/code>, this will output to the screen all the files it is extracting.<\/p>\n<p>Putting all this together the most common two <code>tar<\/code> extraction commands are <code>tar xvzf filname.tar.gz<\/code> and <code>tar xvf filename.tar<\/code><\/p>\n<h3 class=\"kb\">Advanced usage<\/h3>\n<p>Even though the commands above cover most regular usage of the <code>tar<\/code> command there is more that <code>tar<\/code> can do. To concatenate two archives use the <code>-A<\/code> option, to list the contents of an archive use <code>-t<\/code>, to append a file use the <code>-r<\/code> option and to update a file use the <code>-u<\/code> option. Here are some examples of each one:<br \/>\n<code>tar -Af output.tar file1.tar file2.tar<\/code><br \/>\n<code>tar -tfz filename.tar.gz<\/code><br \/>\n<code>tar -rf filename.tar file-to-delete<\/code><\/p>\n<h3 class=\"kb\">Conclusion<\/h3>\n<p>For more information on <code>tar<\/code> please see the man pages <code>man tar<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 The tar command is used to join many files together into one, and optionally compress them. The process is totally reversible. This is used for archival purposes, backups or for sending on to others. Creating a Tar file The tar command has two main options relating to creating an&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":[],"ht-kb-category":[13],"ht-kb-tag":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using GNU Tar - Knowledge Base - Pair Networks<\/title>\n<meta name=\"description\" content=\"The tar command is used to join many files together into one and compress them. This is used for archival purposes, backups, or for sending on to others.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using GNU Tar - Knowledge Base - Pair Networks\" \/>\n<meta property=\"og:description\" content=\"The tar command is used to join many files together into one and compress them. This is used for archival purposes, backups, or for sending on to others.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - Pair Networks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pairnetworks\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-06T18:54:44+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@pairNetworks\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/\",\"name\":\"Using GNU Tar - Knowledge Base - Pair Networks\",\"isPartOf\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\"},\"datePublished\":\"2016-01-12T15:33:13+00:00\",\"dateModified\":\"2019-02-06T18:54:44+00:00\",\"description\":\"The tar command is used to join many files together into one and compress them. This is used for archival purposes, backups, or for sending on to others.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pair.com\/support\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using GNU Tar\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"name\":\"Knowledge Base - Pair Networks\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\",\"name\":\"Pair Networks\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"contentUrl\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"width\":360,\"height\":360,\"caption\":\"Pair Networks\"},\"image\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pairnetworks\/\",\"https:\/\/twitter.com\/pairNetworks\",\"https:\/\/www.instagram.com\/pairnetworks\/\",\"https:\/\/www.linkedin.com\/company\/2269676\/\",\"https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/\",\"https:\/\/www.youtube.com\/user\/pairnetworks\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using GNU Tar - Knowledge Base - Pair Networks","description":"The tar command is used to join many files together into one and compress them. This is used for archival purposes, backups, or for sending on to others.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/","og_locale":"en_US","og_type":"article","og_title":"Using GNU Tar - Knowledge Base - Pair Networks","og_description":"The tar command is used to join many files together into one and compress them. This is used for archival purposes, backups, or for sending on to others.","og_url":"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/","og_site_name":"Knowledge Base - Pair Networks","article_publisher":"https:\/\/www.facebook.com\/pairnetworks\/","article_modified_time":"2019-02-06T18:54:44+00:00","twitter_card":"summary_large_image","twitter_site":"@pairNetworks","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/","url":"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/","name":"Using GNU Tar - Knowledge Base - Pair Networks","isPartOf":{"@id":"https:\/\/www.pair.com\/support\/kb\/#website"},"datePublished":"2016-01-12T15:33:13+00:00","dateModified":"2019-02-06T18:54:44+00:00","description":"The tar command is used to join many files together into one and compress them. This is used for archival purposes, backups, or for sending on to others.","breadcrumb":{"@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-gnu-tar\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pair.com\/support\/kb\/"},{"@type":"ListItem","position":2,"name":"Using GNU Tar"}]},{"@type":"WebSite","@id":"https:\/\/www.pair.com\/support\/kb\/#website","url":"https:\/\/www.pair.com\/support\/kb\/","name":"Knowledge Base - Pair Networks","description":"","publisher":{"@id":"https:\/\/www.pair.com\/support\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pair.com\/support\/kb\/#organization","name":"Pair Networks","url":"https:\/\/www.pair.com\/support\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","contentUrl":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","width":360,"height":360,"caption":"Pair Networks"},"image":{"@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pairnetworks\/","https:\/\/twitter.com\/pairNetworks","https:\/\/www.instagram.com\/pairnetworks\/","https:\/\/www.linkedin.com\/company\/2269676\/","https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/","https:\/\/www.youtube.com\/user\/pairnetworks"]}]}},"_links":{"self":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/212"}],"collection":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":5,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/212\/revisions"}],"predecessor-version":[{"id":6566,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/212\/revisions\/6566"}],"wp:attachment":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=212"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}