{"id":79076,"date":"2026-11-17T01:52:58","date_gmt":"2026-11-17T01:52:58","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79076"},"modified":"2026-11-17T01:52:58","modified_gmt":"2026-11-17T01:52:58","slug":"linux-basics-08-archives","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79076","title":{"rendered":"Linux Basics 08 \u2014 Archives, Compression, and a Restore Test"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1990\">Linux Basics category<\/a> \u00b7 Lesson 8 of 8<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AI disclosure<\/strong> \u2014 AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learning goal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create and inspect an archive, then prove that you can recover a file from it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concepts and setup<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An archive groups files and their metadata. Compression reduces size, along with the ability to inspect or restore only as supported by the format. tar -z uses gzip and tar -t lists members without extracting them. 7-Zip is another archive tool discussed on the site. This exercise adapts the site&#8217;s timed tar and selective restore script to your own lab data rather than copying real system configuration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Archive a lab folder and restore one file<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>lab=$(mktemp -d)\ncd &quot;$lab&quot; || exit\nmkdir -p project restore\nprintf 'service=demo\\n' &gt; project\/settings.txt\nprintf 'release notes\\n' &gt; project\/notes.txt\ntar -czf project.tgz -C project settings.txt notes.txt\ntar -tzf project.tgz\ntar -xzf project.tgz -C restore settings.txt\ncmp project\/settings.txt restore\/settings.txt &amp;&amp;\n  printf 'restore matches the original\\n'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>settings.txt\nnotes.txt\nrestore matches the original<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">-C changes directory for the tar operation, and the member names do not include project\/. Do not extract an untrusted archive over existing files. Inspect its member names and use an isolated destination.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Record an integrity check<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sha256sum project.tgz &gt; project.tgz.sha256\nsha256sum -c project.tgz.sha256\nls -1 restore<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>project.tgz: OK\nsettings.txt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">An integrity checksum tells you whether this artifact matches a known digest. It does not authenticate an archive if an attacker can also replace the checksum file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Questions only<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Which command lists the gzip archive without extracting?<\/li>\n\n\n<li>Did this restore extract notes.txt?<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Change the extraction command to restore both members into a fresh directory.<\/li>\n\n\n<li>Explain why keeping only an archive on the same laptop is not enough for disaster recovery.<\/li>\n\n\n<li>Name a stronger acceptance test than archive creation returned 0.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Questions and answers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check answers<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Which command lists the gzip archive without extracting?<\/strong><br><strong>Answer<\/strong> \u2014 tar -tzf project.tgz.<\/li>\n\n\n<li><strong>Did this restore extract notes.txt?<\/strong><br><strong>Answer<\/strong> \u2014 No. settings.txt was the only requested member.<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment answer key<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Change the extraction command to restore both members into a fresh directory.<\/strong><br><strong>Answer<\/strong> \u2014 Run mkdir restore-all followed by tar -xzf project.tgz -C restore-all.<\/li>\n\n\n<li><strong>Explain why keeping only an archive on the same laptop is not enough for disaster recovery.<\/strong><br><strong>Answer<\/strong> \u2014 One failure or loss can take out both the original and archive. Keep a separate protected copy.<\/li>\n\n\n<li><strong>Name a stronger acceptance test than archive creation returned 0.<\/strong><br><strong>Answer<\/strong> \u2014 Restore selected content into a clean location and compare it to the expected data.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Source articles on this site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=65718\">On Thursday and Friday tar all contents of \/etc folder into \/export\/home\/shell\/test\/etc.tar .. do misc logs #Linux\/Unix: Shell Programming \u2013 001<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=21831\">Some Ubuntu Linux Commands used in AWS platform #Unix\/Linux #RHCSA<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=22419\">Introduction to 7zip and Compression in Linux #Root #By Sayed Ahmed #RHCSA<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Continue the course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Previous lesson 07 \u2014 Processes, Jobs, and Signals. This is the last lesson in this level. See the course index for the next level.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1990\">Linux Basics category<\/a> \u00b7 Lesson 8 of 8<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create and inspect an archive, then prove that you can recover a file from it.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1990],"tags":[],"class_list":["post-79076","post","type-post","status-publish","format-standard","hentry","category-linux-basics","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79102,"url":"http:\/\/bangla.sitestree.com\/?p=79102","url_meta":{"origin":79076,"position":0},"title":"Linux Administration Course \u2014 Start Here and Lesson Index","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"A 33-lesson Linux course from shell fundamentals to server administration, performance, and a recovery capstone.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79075,"url":"http:\/\/bangla.sitestree.com\/?p=79075","url_meta":{"origin":79076,"position":1},"title":"Linux Basics 07 \u2014 Processes, Jobs, and Signals","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Identify a process you own, inspect its state, and stop it gracefully.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79071,"url":"http:\/\/bangla.sitestree.com\/?p=79071","url_meta":{"origin":79076,"position":2},"title":"Linux Basics 03 \u2014 Editing Text and Reading Files","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Edit a text file in a terminal and verify the exact lines you saved.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79070,"url":"http:\/\/bangla.sitestree.com\/?p=79070","url_meta":{"origin":79076,"position":3},"title":"Linux Basics 02 \u2014 Paths, Files, and Links","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Navigate confidently, copy and rename a file, and explain the difference between hard links and symbolic links.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79072,"url":"http:\/\/bangla.sitestree.com\/?p=79072","url_meta":{"origin":79076,"position":4},"title":"Linux Basics 04 \u2014 Pipes, Redirection, and Exit Status","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Route input, normal output, and errors, then detect a command failure inside a pipeline.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79087,"url":"http:\/\/bangla.sitestree.com\/?p=79087","url_meta":{"origin":79076,"position":5},"title":"Linux Advanced 02 \u2014 NFS and On-Demand Mounting with AutoFS","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Create an indirect AutoFS map and distinguish a running automounter from a successful NFS mount.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79076"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79076\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79076"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}