|
L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t hBog'liq linuxbasicsforhackers97
kali >gunzip HackersArise.*
Once uncompressed, the file is no longer saved with the .tar.gz exten-
sion but with the .tar extension instead. Also, notice that it has returned to
its original size of 40,960 bytes. Try doing a long list to confirm this.
Compressing with bzip2
Another of the other widely used compression utilities in Linux is
bzip2
,
which works similarly to
gzip
but has better compression ratios, mean-
ing that the resulting file will be even smaller. You can compress your
HackersArise.tar file by entering the following:
kali >bzip2 HackersArise.*
When you do a long listing, you can see that
bzip2
has compressed the
file down to just 2,081 bytes! Also note that the file extension is now .tar.bz2.
To uncompress the compressed file, use
bunzip2
, like so:
kali >bunzip2 HackersArise.*
kali >
When you do, the file returns to its original size, and its file extension
returns to .tar.
Compressing with compress
Finally, you can use the command
compress
to compress the file. This is
probably the least commonly used compression utility, but it’s easy to
remember. To use it, simply enter the command
compress
followed by the
filename, like so:
kali >compress HackersArise.*
kali >ls -l
--snip--
-rw-r--r-- 1 root root 5476 Nov 27 2018 13:32 HackersArise.tar.Z
Note that the
compress
utility reduced the size of the file to 5,476 bytes,
more than twice the size of
bzip2
. Also note that the file extension now is
.tar.Z (with an uppercase Z).
To decompress the same file, use
uncompress
:
kali >uncompress HackersArise.*
You can also use the
gunzip
command with files that have been com-
pressed with
compress
.
|
| |