{"id":123,"date":"2021-09-17T07:21:56","date_gmt":"2021-09-17T07:21:56","guid":{"rendered":"http:\/\/webhostingpune.co.in\/blog\/?p=123"},"modified":"2021-09-17T07:21:57","modified_gmt":"2021-09-17T07:21:57","slug":"how-to-archive-files-and-directories-in-linux","status":"publish","type":"post","link":"https:\/\/webhostingpune.co.in\/blog\/how-to-archive-files-and-directories-in-linux\/","title":{"rendered":"How To Archive Files and Directories in Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Introduction<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Archiving is the process of combining multiple files and directories (same or different sizes) into one file. On the other hand, compression is the process of reducing the size of a file or directory. Archiving is usually used as part of a system backup or when moving data from one system to another.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Archives and Directories<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The most common programs for archiving files and directories are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Tar<\/li><li>Zip<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Archive files and directories using the tar command<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tar is a Unix command representative TAPE Archive (tape archive). It is used to combine or store multiple files (same or different\u00a0into one file. There are four main modes of operation in the tar utility.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>c \u2013 Create an archive from a file or directory<\/li><li>x \u2013 Extract archive<\/li><li>r \u2013 Append file to archive<\/li><li>t &#8211; List the contents of the archive<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Create a new archive<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Common tar archives:\u00a0tar -cf archive.tar file1 file2 file3<\/li><li>Gzip tar archive: tar -czf archive.tgz file1 file2 file3<\/li><li>Bzip tar archive: tar -cjf archive.tbz file1 file2 file3<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"252\" src=\"http:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar.png\" alt=\"\" class=\"wp-image-124\" srcset=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar.png 909w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar-300x83.png 300w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar-768x213.png 768w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><figcaption>SYNTAX 1<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Extract tar archives:<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Common tar archives: tar -xf archive.tar<\/li><li>Gzip tar archive: tar -xzf archive.tgz<\/li><li>Bzip tar archive: tar -xjf archive.tbz<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"160\" src=\"http:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar1.png\" alt=\"\" class=\"wp-image-125\" srcset=\"https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar1.png 849w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar1-300x57.png 300w, https:\/\/webhostingpune.co.in\/blog\/wp-content\/uploads\/2021\/09\/tar1-768x145.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><figcaption>SYNTAX 2<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Archiving is the process of combining multiple files and directories (same or different sizes) into one file. On the other hand, compression is the process of reducing the size of a file or directory. Archiving is usually used as part of a system backup or when moving data from one system to another. Archives and Directories The most common programs for archiving files and directories are: Tar Zip Archive files and directories using the tar command Tar is a Unix command representative TAPE Archive (tape archive). It is used to combine or store multiple files (same or different\u00a0into one file. There are four main modes of operation in the tar utility. c \u2013 Create an archive from a file or directory x \u2013 Extract archive r \u2013 Append file to archive t &#8211; List the contents of the archive Create a new archive Common tar archives:\u00a0tar -cf archive.tar file1 file2 file3 Gzip tar archive: tar -czf archive.tgz file1 file2 file3 Bzip tar archive: tar -cjf archive.tbz file1 file2 file3 Extract tar archives: Common tar archives: tar -xf archive.tar Gzip tar archive: tar -xzf archive.tgz Bzip tar archive: tar -xjf archive.tbz<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/comments?post=123"}],"version-history":[{"count":1,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/123\/revisions\/126"}],"wp:attachment":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}