It's no secret that a Linux system has a lot of files. A typical code development project might have over 1000 files, spread across several directories. And how do we back all of that stuff up?
The answer is file packaging and compression. Here we will show two favorites, ZIP and TAR.
Most Linux systems have both ZIP and TAR, and so it will be assumed they are already available on your system.
Here we will experiment with the zip
and unzip
command::
Run the following command:
cd /tmp
Let's make a temporary directory:
mkdir lbooktemp
Run the following command:
cd lbooktemp
Now let's create some files:
ls > f1.txt; route > f2.txt; dmesg > f3.txt
Then, create some more files:
ifconfig > ifconfig.dat; dmesg > dmesg.dat
Let's package and compress the first ones into a single file:
zip lbook1.zip f1.txt f2.txt f3.txt
As you can see, the syntax for ZIP is "zip zipped-file files-to-zip". We could have also used wildcards...