<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ data compression - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ data compression - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 30 May 2026 16:32:04 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/data-compression/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Linux tar Command – How to Compress Files in Linux ]]>
                </title>
                <description>
                    <![CDATA[ File compression is an essential utility across all platforms. It helps you reduce file size and share files efficiently. And compressed files are also easier to copy to remote servers.  You can also compress older and rarely used files and save them... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-compress-files-in-linux-with-tar-command/</link>
                <guid isPermaLink="false">66adea3ec537123a64ede800</guid>
                
                    <category>
                        <![CDATA[ compression ]]>
                    </category>
                
                    <category>
                        <![CDATA[ data compression ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Zaira Hira ]]>
                </dc:creator>
                <pubDate>Wed, 06 Oct 2021 16:19:13 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/09/Linux-File-Tar-Compression.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>File compression is an essential utility across all platforms. It helps you reduce file size and share files efficiently. And compressed files are also easier to copy to remote servers. </p>
<p>You can also compress older and rarely used files and save them for future use which helps you conserve disk space.</p>
<p>In this post, we'll look at how to compress files with the <code>tar</code> command in Linux, along with some examples of <code>tar</code> in action.</p>
<h2 id="heading-what-is-the-tar-command">What is the tar command?</h2>
<p>We use the <code>tar</code> command to compress and expand files from the command line. The syntax is shown below:</p>
<pre><code class="lang-bash">tar [flags] destinationFileName sourceFileName
</code></pre>
<p> The <code>tar</code> command uses the following flags to customize the command input:</p>
<table>
<thead>
<tr>
<th>Flag</th>
<th>Explanation</th>
<th>Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>-c</td>
<td>Create a new archive.</td>
<td>We use this flag whenever we need to create a new archive.</td>
</tr>
<tr>
<td>-z</td>
<td>Use gzip compression.</td>
<td>When we specify this flag, it means that archive will be created using gzip compression.</td>
</tr>
<tr>
<td>-v</td>
<td>Provide verbose output.</td>
<td>Providing the -v flag shows details of the files compressed.</td>
</tr>
<tr>
<td>-f</td>
<td>Archive file name.</td>
<td>Archive file names are mapped using the -f flag.</td>
</tr>
<tr>
<td>-x</td>
<td>Extract from a compressed file.</td>
<td>We use this flag when files need to be extracted from an archive.</td>
</tr>
</tbody>
</table>

<h3 id="heading-how-to-create-an-archive">How to create an archive</h3>
<p>We have a list of the following files which we'll compress with <code>tar</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/image-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>List of files to be compressed.</em></p>
<p>To compress them, we'll use <code>tar</code> like this:</p>
<pre><code class="lang-bash">tar -czvf logs_archive.tar.gz *
</code></pre>
<p>Let's break down this command and look into each flag.</p>
<p><code>-c</code> is creating and archive.</p>
<p><code>-z</code> is using gzip compression.</p>
<p><code>-v</code> is providing details of the files that have been archived.</p>
<p><code>-f</code> is creating an archive with the name 'logs_archive.tar.gz' as supplied in the command above.</p>
<p>In the results below, we can see that the archive has been created successfully.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/image-13.png" alt="Image" width="600" height="400" loading="lazy">
<em>Archive has been created with supplied command.</em></p>
<h3 id="heading-how-to-remove-files-after-compression">How to remove files after compression</h3>
<p>Let's say we don't want to keep the original files after creating an archive. For that, we can use the <code>--remove-files</code> flag.</p>
<pre><code class="lang-bash">tar -czvf logs_archive.tar.gz * --remove-files
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/image-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Files removed once archive has been created</em></p>
<p>Here, the <code>-czvf</code> flags are working as demonstrated before, but the original files are also removed. Once we list the files, we only see the archive.</p>
<h3 id="heading-how-to-view-the-contents-of-an-archive">How to view the contents of an archive</h3>
<p>You might need to view the contents of an archive without actually extracting it. You can do this with the <code>-t</code> flag.</p>
<pre><code class="lang-bash">tar -tvf logs_archive.tar.gz
</code></pre>
<p>In this command, <code>-t</code> flag specifies that we need to only view the contents of the archive. <code>-f</code> specifies the filename and <code>-v</code> displays the detailed contents.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/image-4.png" alt="Image" width="600" height="400" loading="lazy">
<em>Viewing contents of an archive.</em></p>
<h3 id="heading-how-to-extract-an-archive">How to extract an archive</h3>
<p>To extract files from an archive, you use the <code>-x</code> flag like this:</p>
<pre><code class="lang-bash">tar -xzvf logs_archive.tar.gz
</code></pre>
<p>Let's break down this command and look into each flag.</p>
<p><code>-x</code> is extracting and archive.</p>
<p><code>-z</code> specifies that the archive is gzip.</p>
<p><code>-v</code> is providing details of the files that have been archived.</p>
<p><code>-f</code> is extracting from the archive named 'logs_archive.tar.gz'.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/image-14.png" alt="Image" width="600" height="400" loading="lazy">
<em>Extracting an archive.</em></p>
<p>Here's a useful tip: commands that take a long time to execute can continue in the background with <code>&amp;</code>. </p>
<p>Adding files to an archive and extracting an archive can take a while. To keep the commands running in the background while you keep working, pair the command with <code>&amp;</code> like this:</p>
<pre><code class="lang-bash">tar -xzvf logs_archive.tar.gz &amp;
</code></pre>
<h3 id="heading-how-to-search-in-compressed-log-files">How to search in compressed log files</h3>
<p>You might still need to access certain files once they're archived. Luckily, there is a method you can use to search and view compressed log files without decompressing them and compromising disk space.</p>
<p>The command you can use to search in compressed files is <code>zgrep</code>:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/image-6.png" alt="Image" width="600" height="400" loading="lazy">
<em>Contents of a file 'audit.log' in an archive.</em></p>
<p>We can search for a string in an archive using the below command:</p>
<pre><code class="lang-bash"> zgrep -Hna <span class="hljs-string">'string-to-search'</span> compressedFile.tar.gz
</code></pre>
<p>Let's briefly look at the flags.</p>
<p><code>-H</code> lists the file name that contains the match.</p>
<p><code>-n</code> displays the line number that contains the matched string.</p>
<p><code>-a</code> treats all files as text files. </p>
<p>This is the result:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/image-15.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>File compression helps us save time and resources when sharing files. Servers are almost always rotating and archiving huge log files. </p>
<p>You can also schedule file compression via <code>cron</code> jobs to automate disk cleaning. I highly recommend that you take advantage of this utility.</p>
<p>Thanks for reading until the end. I would love to connect with you. You can find me <a target="_blank" href="https://twitter.com/hira_zaira">here</a> on Twitter. Do share your thoughts.</p>
<p>See you around.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Does Data Compression matter on a Quantum Internet? ]]>
                </title>
                <description>
                    <![CDATA[ By Colt McAnlis Disclaimer: This is a hypothetical think piece. It is a personal opinion and doesn’t represent the opinion of any of the companies (or secret societies) I may (..or may not) be involved with. If you tear a hole through space-time afte... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/does-data-compression-matter-on-a-quantum-internet-f6b986473c1c/</link>
                <guid isPermaLink="false">66c349845ced6d98e4bd32c1</guid>
                
                    <category>
                        <![CDATA[ data compression ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ quantum computing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 28 Jun 2017 15:37:24 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*jB_VRVuG5z8Dtp2i4N1o9g.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Colt McAnlis</p>
<p><em>Disclaimer: This is a hypothetical think piece. It is a personal opinion and doesn’t represent the opinion of any of the companies (or secret societies) I may (..or may not) be involved with. If you tear a hole through space-time after reading this article… that’s your own fault.</em></p>
<p>If you haven’t heard, a research team out of China just made a huge leap with respect to realization of using <a target="_blank" href="http://science.sciencemag.org/cgi/doi/10.1126/science.aan3211">Quantum Entanglement as a valid communication vessel</a>. Their process was to use a low-earth satellite to create a pair of entangled photons and then send them to locations very far apart from each other. Even at never-before-done distances, the photons retained their entanglement, which has set the internet a buzz about the future of communication, and when the new quantum internet will happen.</p>
<p>Now, looking at the math, <strong>I’m still a bit dubious that quantum entanglement</strong> could be viably used for communication. This math person <a target="_blank" href="https://www.forbes.com/sites/chadorzel/2016/05/04/the-real-reasons-quantum-entanglement-doesnt-allow-faster-than-light-communication/#1c0c3f153a1e">explains</a> it a <a target="_blank" href="https://medium.com/starts-with-a-bang/ask-ethan-can-we-use-quantum-entanglement-to-communicate-faster-than-light-e0d7097c0322">bit better than</a> I ever could. However, there’s lots of people hypothesizing that this is the first steps in a new quantum internet where things like <a target="_blank" href="http://spectrum.ieee.org/telecom/security/two-steps-closer-to-a-quantum-internet">Entanglement Swapping</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/Orbital_angular_momentum_of_light">Twisted Light</a> could bridge those gaps.</p>
<p><strong>Then let’s propose a thought experiment</strong>: let’s assume there’s future where an internet exists, whose technology is based on quantum entanglement. This means that data can be transmitted between two locations, at close to speed-of-light without a physical connecting medium between the locations.</p>
<p>In such a world, does data compression matter any more?</p>
<h3 id="heading-a-small-idea-on-how-a-qe-internet-would-work">A small idea on how a QE internet would work</h3>
<p>We have to assume that due to current technology, the first realization of a QE Internet (QEI) would be very similar to the telegraph systems of the past. The cost to maintain and run these early QEI sites would limit their availability, meaning that communication could only occur between a handful of sites.</p>
<p>These sites would require two primary features:</p>
<ol>
<li>A non-centralized system which can distribute entangled photon pairs to the sites (a low-orbit satellite, for example).</li>
<li>A recording system which logs the results of the entanglement tests and can store / retrieve them.</li>
</ol>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Xp0h0wKzejEnv3nQ4yA-OAbVQ0AZU064giIv" alt="Image" width="800" height="475" loading="lazy"></p>
<p>#2 would be most likely built on today’s modern technology. So you can expect a situation where a billion photon pairs are sent to a site, and sampled in unison, and stored as binary data at the location.</p>
<p>From that point, the data would be most likely distributed to it’s final destination using more conventional methods (e.g. fiber connection).</p>
<h3 id="heading-limitations-of-a-first-generation-qei">Limitations of a first generation QEI</h3>
<p>Obviously, we still end up with some data-based bottlenecks here:</p>
<ol>
<li>There is a physical limit to how many entangled pairs can be stored at a site, thus limiting it’s total bandwidth.</li>
<li>There is a physical limit to the speed in which entangled pairs can be sent from the distributor to the sites on a regular basis, thus limiting total system bandwidth.</li>
<li>Environmental factors will cause loss of data in the transfer of photons to the sites from the distributor system. Thus, there will be a need for redundancy in the process, limiting total system bandwidth.</li>
</ol>
<p>When observing the above, you can quickly seen that the overall bandwidth of a QEI would be limited by the above systems, regardless of the ability for information to travel between sites through quantum means. So obviously, reducing the size of the data being sent through the sites will be important, but will today’s data compression algorithms make sense?</p>
<h3 id="heading-data-compression-for-a-qei">Data compression for a QEI</h3>
<p>There’s a few definitions of “data” which represents it as a physical entity, and as the (potential) realization of a Quantum Internet is realized, the need for photon transferal makes this concept even more real.</p>
<p>In fact, that may be the largest ramification of a quantum entangled internet: your data now has a very physical manifestation and cost involved with it.</p>
<p>So it’s obvious that data compression, as a science, will still be needed in a QEI future, but the real question we should be asking ourselves is: <strong>Are today’s compression algorithms good enough to support a quantum internet?</strong></p>
<p>My opinion? Not even close.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/muYjkNnMLxY6BjdD-TiW37VflNvJOFyizCaS" alt="Image" width="256" height="336" loading="lazy"></p>
<p>As explained in “<a target="_blank" href="https://www.amazon.com/Understanding-Compression-Data-Modern-Developers/dp/1491961538">Understanding Compression</a>” today’s systems are still grounded around Shannon’s basic architecture of ‘<em>the most frequent symbol gets the smallest bits.</em>’ There’s a lot of power in this process, but until we move out of symbol space, and start gaining the computational power to handle compression entirely in bit-vector space, <a target="_blank" href="http://ieeexplore.ieee.org/abstract/document/1054929/">we’re going to be leaving a lot of information on the table</a>. (But <em>that’s my own unpopular opinion...</em>)</p>
<p>Let’s look beyond that. Are there potential systems where, rather than applying <a target="_blank" href="https://github.com/google/brotli">Brotli</a> to a data set, we instead can apply in to entangled photons directly? Will we start talking about algorithms to do diff’s against the photons on a site, and the data being transmitted, so we can reduce the number of updated pairs? What happens when we start thinking in terms of <a target="_blank" href="https://en.wikipedia.org/wiki/Qubit">qubits</a>, rather than just bits? Do we have to start thinking about LZ encoding in 8 dimensional space?</p>
<p>Obviously, the realization and standardization of Quantum Computing will create a massive technological shift in how our world works. And I’ve got every reason to believe that Data Compression will be right there, too.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
