<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tar.gz on the art of simplicity</title><link>https://naoko.github.io/tags/tar.gz/</link><description>Recent content in Tar.gz on the art of simplicity</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 07 Aug 2019 00:00:00 +0000</lastBuildDate><atom:link href="https://naoko.github.io/tags/tar.gz/index.xml" rel="self" type="application/rss+xml"/><item><title>Create and Extract tar.gz on Ubuntu</title><link>https://naoko.github.io/posts/2019-08-07-compress-targz/</link><pubDate>Wed, 07 Aug 2019 00:00:00 +0000</pubDate><guid>https://naoko.github.io/posts/2019-08-07-compress-targz/</guid><description>&lt;h3 id="create-targz-archives"&gt;Create tar.gz archives&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar czf new-tar-file-name.tar.gz file-or-folder-to-archive
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;c - create new archive
z - compress the archive using gzip
f - use archive file&lt;/p&gt;
&lt;h3 id="extract-archives"&gt;Extract archives&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -xzf tar-file-name.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;x - extract the archive.
z - uncompress the archive using gzip.
f - use archive file.&lt;/p&gt;
&lt;h3 id="lets-do-it"&gt;Let&amp;rsquo;s do it.&lt;/h3&gt;
&lt;p&gt;I only want to compress 3 files.
When I extract archive what I want to see is files in the directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ tree file_dir/
file_dir/
├── file1.txt
├── file2.txt
└── file3.txt

$ cd file_dir
$ tar czf files.tar.gz .
tar: .: file changed as we read it

# moved files.tar.gz to different directory
$ tar -xzf files.tar.gz 
$ ls
file1.txt file2.txt file3.txt file_dir files.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Cheers!&lt;/p&gt;</description></item></channel></rss>