Chapter 4. Managing Files and Directories
Tip
For more information, type
and
bzip2
bunzip2
4.3.2.2. Gzip and Gunzip
To use
to compress a file, type the following command at a shell prompt:
gzip
gzip filename
The file is compressed and saved as
To expand the compressed file, type the following command:
gunzip filename.gz
The
compressed file is deleted and replaced with
filename.gz
You can use
to compress multiple files and directories at the same time by listing them with a
gzip
space between each one:
gzip -r filename.gz file1 file2 file3 /usr/work/school
The above command compresses
/usr/work/school/
.
filename.gz
Tip
For more information, type
and
gzip
gunzip
4.3.2.3. Zip and Unzip
To compress a file with
zip -r filename.zip filesdir
In this example,
filename.zip
directory you want to put in the new zip file. The
contained in the
filesdir
To extract the contents of a
unzip filename.zip
You can use
to compress multiple files and directories at the same time by listing them with a
zip
space between each one:
zip -r filename.zip file1 file2 file3 /usr/work/school
man bzip2
.
filename.gz
file1
directory (assuming this directory exists) and places them in a file named
and
man gzip
.
, type the following command:
zip
represents the file you are creating and
directory recursively.
file, type the following command:
zip
and
at a shell prompt to read the man pages for
man bunzip2
.
,
,
file2
file3
at a shell prompt to read the man pages for
man gunzip
option specifies that you want to include all files
-r
.
filename
, and the contents of the
filesdir
53
represents the