Compressing and archiving files
There is a difference between a compressed and an archive file. So, what is an archive file? It is a collection of files and directories that are stored in a single file. An archive file is not a compressed file.
What is a compressed file? This is a collection of files and directories stored in one file. It uses less disk space for storage.
In this section, we are going to discuss two compression tools:
bzip2
zip
Getting ready
You should have files to archive and compress.
How to do it...
First, let's see how we can compress the files:
- We are going to look at compression with the help of
bzip2
. Decide which file to compress and run the following command:
$ bzip2 filename
Using bzip2
, we can compress multiple files and directories at the same time. Just separate them by putting a space between each of them. You can compress it as follows:
$ bzip2 file1 file2 file3 /student/work
- We are going to use
zip
for compression. By using the zip compression tool, files are compressed...