<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Archiving_and_Compression</id>
	<title>Archiving and Compression - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Archiving_and_Compression"/>
	<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Archiving_and_Compression&amp;action=history"/>
	<updated>2026-05-16T15:47:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://dikapediav2.com/wiki/index.php?title=Archiving_and_Compression&amp;diff=26&amp;oldid=prev</id>
		<title>Ardika Sulistija: Created page with &quot;  It is always good to have a backup. You can use the cp command, or you can archive it using tar and compress it using gzip, that way you will save some space.    ====Archiving and Compression==== ----   This will archive and compress using gzip! Be sure to end in &#039;.gz&#039; and use -z, -z is for gzip:  tar -zcvf [newArchiveName.tar.gz] [file/dir you want to archive]  This will archive files and compressing using bzip2! Be sure to end name with &#039;.bz2&#039; and use -j. -j is for b...&quot;</title>
		<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Archiving_and_Compression&amp;diff=26&amp;oldid=prev"/>
		<updated>2024-08-20T05:41:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;  It is always good to have a backup. You can use the cp command, or you can archive it using tar and compress it using gzip, that way you will save some space.    ====Archiving and Compression==== ----   This will archive and compress using gzip! Be sure to end in &amp;#039;.gz&amp;#039; and use -z, -z is for gzip:  tar -zcvf [newArchiveName.tar.gz] [file/dir you want to archive]  This will archive files and compressing using bzip2! Be sure to end name with &amp;#039;.bz2&amp;#039; and use -j. -j is for b...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
It is always good to have a backup. You can use the cp command, or you can archive it using tar and compress it using gzip, that way you will save some space. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Archiving and Compression====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will archive and compress using gzip! Be sure to end in &amp;#039;.gz&amp;#039; and use -z, -z is for gzip:&lt;br /&gt;
 tar -zcvf [newArchiveName.tar.gz] [file/dir you want to archive]&lt;br /&gt;
&lt;br /&gt;
This will archive files and compressing using bzip2! Be sure to end name with &amp;#039;.bz2&amp;#039; and use -j. -j is for bzip:&lt;br /&gt;
 tar -jcvf [newArchive.tar.bz2] [file/dir]&lt;br /&gt;
&lt;br /&gt;
I.e: backed up your home directory and stored it into Backups directory, perserves permissions, verbose, gzip/compressions, etc.: &lt;br /&gt;
 tar -cvpzf ~/Backups/backup.tar.gz ~/  &lt;br /&gt;
&lt;br /&gt;
How I backed up my /etc/letsencrypt directory, did the same to my /var/www:&lt;br /&gt;
 DATE=$(date +&amp;quot;%d-%b-%Y&amp;quot;); tar -zcvf ./letsencrypt-$DATE.tar.gz letsencrypt/&lt;br /&gt;
&lt;br /&gt;
* NOTE, when you extract the files it will create the file where you are unless you specify.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to extract .tar.xz file====&lt;br /&gt;
 tar -xf linux-5.6.13.tar.xz&lt;br /&gt;
 tar -xvf linux-5.6.13.tar.xz&lt;br /&gt;
 tar -Jxvf linux-5.6.13.tar.xz&lt;br /&gt;
 ## extract tar.xz files aka .txz file ##&lt;br /&gt;
 tar --xz -xf archive.txz&lt;br /&gt;
&lt;br /&gt;
====Archiving Files====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;tar&amp;lt;/b&amp;gt; - an archiving utility that DOES NOT do compression. Allows us to create archive. Collects a number of files/dir into a single file for backup/archiving.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To archive files, where &amp;lt;b&amp;gt;c&amp;lt;/b&amp;gt; -&amp;gt; create ; &amp;lt;b&amp;gt;v&amp;lt;/b&amp;gt; -&amp;gt; Verbose ; &amp;lt;b&amp;gt;f&amp;lt;/b&amp;gt; -&amp;gt; file or archive device; &amp;lt;b&amp;gt;*&amp;lt;/b&amp;gt; -&amp;gt; all files and directories:&lt;br /&gt;
 tar -cvf  [newArchive.tar] [dir/file you want to archive]&lt;br /&gt;
&lt;br /&gt;
To e&amp;lt;b&amp;gt;X&amp;lt;/b&amp;gt;tract the contents from the archived file:&lt;br /&gt;
 tar -xvf  [Archive.tar]&lt;br /&gt;
&lt;br /&gt;
To show the contents of the archive folder (&amp;lt;b&amp;gt;-t&amp;lt;/b&amp;gt;):&lt;br /&gt;
 tar -tvf  [Archive.tar]&lt;br /&gt;
&lt;br /&gt;
To add a file/dir to an archived file:&lt;br /&gt;
 tar -rvf  [Archive.tar] [file/dir]&lt;br /&gt;
&lt;br /&gt;
To perserve the permissions of the original file:&lt;br /&gt;
 tar -p&lt;br /&gt;
&lt;br /&gt;
To &amp;lt;b&amp;gt;compress/uncompress&amp;lt;/b&amp;gt; the file size using &amp;lt;b&amp;gt;gzip&amp;lt;/b&amp;gt; (Recommend you SHOULD do it, why not):&lt;br /&gt;
 tar -z&lt;br /&gt;
&lt;br /&gt;
Real world example from work: eXtract, compress(gzip), verbose, file&lt;br /&gt;
 tar -xzvf [archive.tar.gz] [dir/file]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====File Compression====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;gzip&amp;lt;/b&amp;gt; - compresses quicker (z)&lt;br /&gt;
&lt;br /&gt;
Compress file:&lt;br /&gt;
 gzip [file] [file]&lt;br /&gt;
&lt;br /&gt;
Eextract/normalize file&lt;br /&gt;
 gzip -d [file.gz] &lt;br /&gt;
&lt;br /&gt;
Provide a compression information (a compression/uncompression ratio):&lt;br /&gt;
 gzip -l [file.gz] ...&lt;br /&gt;
&lt;br /&gt;
To decompress:&lt;br /&gt;
 gunzip -d [file.tar.gz]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How to view compressed file:&lt;br /&gt;
* You can use gunzip then cat it:&lt;br /&gt;
 gunzip scan.runzero.gz&lt;br /&gt;
 gunzip -d scan.runzero.gz&lt;br /&gt;
 gzip -d scan.runzero.gz&lt;br /&gt;
&lt;br /&gt;
* You can also use zcat:&lt;br /&gt;
 zcat scan.runzero.gz&lt;br /&gt;
&lt;br /&gt;
You can even redirect it to a file like: zcat scan.runzero.gz &amp;gt; file&lt;br /&gt;
* zless:&lt;br /&gt;
 zless scan.runzero.gz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;bzip2&amp;lt;/b&amp;gt; - bzip2, bunzip2 - a block-sorting file compressor. bzip2  compresses  files  using  the  Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Bzip2 uses &amp;lt;b&amp;gt;LESS SPACE&amp;lt;/b&amp;gt; for the compressed file (j).&lt;br /&gt;
&lt;br /&gt;
Compresses file&lt;br /&gt;
 bzip2 [file] &lt;br /&gt;
 &lt;br /&gt;
Extract files from bzip&lt;br /&gt;
 bunzip2 [file.bz2]&lt;/div&gt;</summary>
		<author><name>Ardika Sulistija</name></author>
	</entry>
</feed>