{"id":7366,"date":"2004-03-23T01:48:58","date_gmt":"2004-03-22T23:48:58","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/check-if-the-file-is-in-the-archive\/"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T22:00:00","slug":"check-if-the-file-is-in-the-archive","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/check-if-the-file-is-in-the-archive\/","title":{"rendered":"Check if the file is in the archive"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>\t<img decoding=\"async\" class=\"alignright\" src=\"\/wordpress\/wp-content\/20040420-GNU.gif\" alt=\"\">We all use gzip-ped tar achrives (.tar.gz) like mad. Sometimes, though, we need to check if the file is in the archive without extracting the whole damn thing on to the poor hard disk :)\n<\/p>\n<p><!--more-->\t<\/p>\n<p>Consider for example, the presence of the .spec file in the .tar.gz, so that you can build an RPM:<\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n[leonid@home tmp]$ tar tzvf somefile.tar.gz | grep somefile.spec<br \/>\n<br \/>\n<\/code><\/p>\n<\/div>\n<p>Another need arises sometimes &#8211; to check if the archive will extract into a newly created directory or if it will mess up with the content of the current directory (some people still do it). Here is how the proper archive will look:<\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n[leonid@home tmp]$ tar tzvf somefile.tar.gz<br \/>\n<br \/>\nsomefile\/COPYING<br \/>\n<br \/>\nsomefile\/README<br \/>\n<br \/>\nsomefile\/Makefile<br \/>\n<br \/>\nsomefile\/somefile.c<br \/>\n<br \/>\n<\/code><\/p>\n<\/div>\n<p>In the above example you can see, that you will extract the archive (tar xzvf somefile.tar.gz), then it will create a directory somefile and place all it&#8217;s content there. Below is the example of the bad archive which will mess up your current directory.<\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n[leonid@home tmp]$ tar tzvf somefile.tar.gz<br \/>\n<br \/>\nCOPYING<br \/>\n<br \/>\nREADME<br \/>\n<br \/>\nMakefile<br \/>\n<br \/>\nsomefile.c<br \/>\n<br \/>\n<\/code><\/p>\n<\/div>\n<p>To extract this archive and be able to clean it up lately do the following:<\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n[leonid@home tmp]$ mkdir somefile<br \/>\n<br \/>\n[leonid@home tmp]$ mv somefile.tar.gz somefile\/<br \/>\n<br \/>\n[leonid@home tmp]$ cd somefile<br \/>\n<br \/>\n[leonid@home somefile]$ tar xzvf somefile.tar.gz<br \/>\n<br \/>\n<\/code><\/p>\n<\/div>\n<p>That&#8217;s it.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>We all use gzip-ped tar achrives (.tar.gz) like mad. Sometimes, though, we need to check if the file is in the archive without extracting the whole damn thing on to the poor hard disk :)<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,62],"tags":[],"keyring_services":[],"class_list":["post-7366","post","type-post","status-publish","format-standard","hentry","category-general","category-technology"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":8319,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/12\/10\/disappearing-files\/","url_meta":{"origin":7366,"position":0},"title":"Disappearing files","author":"Leonid Mamchenkov","date":"December 10, 2004","format":false,"excerpt":"Some known facts can use more reminders... Fedora Core Linux 2, as well as many other Linux and Unix machines, has a script (\/etc\/cron.daily\/tmpwatch) that is regularly executed by cron, which goes around your temporary directories and removes old files. This is a very useful utilty which helps to keep\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":46078,"url":"https:\/\/mamchenkov.net\/wordpress\/2020\/01\/30\/install-postman-on-fedora-31\/","url_meta":{"origin":7366,"position":1},"title":"Install Postman on Fedora 31","author":"Leonid Mamchenkov","date":"January 30, 2020","format":false,"excerpt":"Postman is a great tool for building and testing APIs. Unfortunately, however, it doesn't come packaged as an RPM, so there's some trickery involved in installing it on Fedora. This blog post was very useful, with some minor corrections. Here's what I had to do: Download Postman from the site.Move\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9499,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/09\/26\/recursively-renaming-files-in-linux\/","url_meta":{"origin":7366,"position":2},"title":"Recursively renaming files in Linux","author":"Leonid Mamchenkov","date":"September 26, 2005","format":false,"excerpt":"One thing I liked about Linux is it's hidden simplicity. When in a hurry, I usually go for the first working solution of a given problem. If the same problem appears often, I can get used to the first solution so much that I don't even think about simplifying it.\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8409,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/01\/03\/mplayerplug-in\/","url_meta":{"origin":7366,"position":3},"title":"mplayerplug-in","author":"Leonid Mamchenkov","date":"January 3, 2005","format":false,"excerpt":"By the way, if you are still using an old way of watching movies from the web, which involves downloading a film and than playing it or associating the file extensions with some programs, than you should try the mplayerplug-in. After you install it, your Mozilla browser (yes, that includes\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7364,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/resizing-or-rotating-a-banch-of-images\/","url_meta":{"origin":7366,"position":4},"title":"Resizing or rotating a banch of images","author":"Leonid Mamchenkov","date":"March 23, 2004","format":false,"excerpt":"It is very often that one has a need to rotate a bunch of images by 90 or 180 degrees clockwise or otherwise, or resize the same bunch of images to a certain size. Read more to learn how you can do it. First of all, you should defenetely install\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12626,"url":"https:\/\/mamchenkov.net\/wordpress\/2010\/06\/22\/google-services-via-command-line\/","url_meta":{"origin":7366,"position":5},"title":"Google services via command line","author":"Leonid Mamchenkov","date":"June 22, 2010","format":false,"excerpt":"I don't know how I missed the announcement and why there is no noise around this release, but here it goes. \u00a0GoogleCL is a tool that you use from the command line to access Google web services. \u00a0I just installed it on my Fedora 13 laptop and its awesome! Here\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/7366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=7366"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/7366\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=7366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=7366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=7366"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=7366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}