{"id":333,"date":"2016-06-25T08:47:45","date_gmt":"2016-06-25T07:47:45","guid":{"rendered":"http:\/\/104.198.79.120\/?p=333"},"modified":"2016-06-25T08:48:27","modified_gmt":"2016-06-25T07:48:27","slug":"extract-single-filedirectory-from-tar-gz-archive","status":"publish","type":"post","link":"https:\/\/wp.gaborhargitai.hu\/extract-single-filedirectory-from-tar-gz-archive\/","title":{"rendered":"Extract single file\/directory from tar gz archive"},"content":{"rendered":"

Doing automated backups is a must for every sysadmin worth its’ salt. If you happen to administer a smaller pool of servers\/hosts it is more than likely that you have your backups tarballed and stored somewhere relatively safe.<\/p>\n

Restoring from such a backup is an easy process, but what if you only need to fetch a single file or directory from that\u00a0.tar \/\u00a0<\/strong>.tar.gz<\/strong> file?<\/p>\n

First, you should list out the contents of the archive (and preferably pipe it to grep to find what you need):
\ntar -tvf backup.tar<\/code><\/p>\n

With grep passed on as well:
\ntar -tvf backup.tar |\u00a0grep directoryname<\/code><\/p>\n

After you’ve found what you are looking for, it’s time to extract it using:
\ntar -xvf backup.tar var\/www\/directoryname<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"

Doing automated backups is a must for every sysadmin worth its’ salt. If you happen to administer a smaller pool of servers\/hosts it is more than likely that you have your backups tarballed and stored somewhere relatively safe. Restoring from such a backup is an easy process, but what if you only need to fetch […]<\/p>\n","protected":false},"author":1,"featured_media":334,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,6,17,7],"tags":[],"_links":{"self":[{"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/posts\/333"}],"collection":[{"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/comments?post=333"}],"version-history":[{"count":1,"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":335,"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/posts\/333\/revisions\/335"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/media\/334"}],"wp:attachment":[{"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/media?parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/categories?post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.gaborhargitai.hu\/wp-json\/wp\/v2\/tags?post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}