Novell LINUX ENTERPRISE SERVER 10 - INSTALLATION AND ADMINISTRATION 04-08-2006 Installation Manual page 357

Table of Contents

Advertisement

-f
(for file) Choose a filename for the archive file. When creating an archive, this
option must always be given as the last one.
To pack the test directory with all its files and subdirectories into an archive named
testarchive.tar, do the following:
1 Open a shell.
2 Use cd to your home directory where the test directory is located.
3 Enter tar -cvf testarchive.tar test. The -c option creates the
archive, making it a file as directed by -f. The -v option lists the files as they
are processed.
4 View the contents of the archive file with tar -tf testarchive.tar.
The test directory with all its files and directories has remained unchanged on your
hard disk. To unpack the archive, enter tar -xvf testarchive.tar, but do not
try this yet.
For file compression, the obvious choice is gzip or, for a even better compression ratio,
bzip2. Just enter gzip testarchive.tar (or bzip2 testarchive.tar,
but gzip is used in this example). With ls, now see that the file testarchive.tar
is no longer there and that the file testarchive.tar.gz has been created instead.
This file is much smaller and therefore much better suited for transfer via e-mail or
storage on a USB stick.
Now, unpack this file in the test2 directory created earlier. To do so, enter cp
testarchive.tar.gz test2 to copy the file to that directory. Change to the
directory with cd test2. A compressed archive with the .tar.gz extension can
be unzipped with the gunzip command. Enter gunzip testarchive.tar.gz,
which results in the file testarchive.tar, which then needs to be extracted or
untarred with tar -xvf testarchive.tar. You can also unzip and extract a
compressed archive in one step with tar -xvf testarchive.tar.gz (adding
the -z option is no longer required). With ls, you can see that a new test directory
has been created with the same contents as your test directory in your home directory.
Working with the Shell
357

Advertisement

Table of Contents
loading

This manual is also suitable for:

Suse linux enterprise server 10

Table of Contents