Make your own free website on Tripod.com

BACK

tar and gzip

tar

To store files in an archive, combines many files into 1, not compressed, can do subdirectories.  Do man tar for complete list of options

Syntax:

# tar  [ options ] backup_filename   /directory/file_to_backup

Example:

# tar -cvf  /backup  /etc/*

Options:  (partial)

-c create
-v verify
-f file
-x extract
-z reads files through gzip
-h follow symbolic links when archiving instead of just link names
--help shows help
-r append to the end of the file
-d compare archive with actual files
-t lists members of archive
-Z decompress at same time when reading or writing
-w interactive, asks before destructive operations
-k keeps old files when extracting
-O extracts to standard output
-version displays version number, copyright message, and some credits

 


gzip

Compresses and decompresses files, usually used with tar to compress a large number of files together

Syntax:

# gzip [ options ] filename

Examples:

# gzip  -d  samba-2.0.7.tar.gz (decompresses samba-2.0.7.tar)

# gzip  /usr/novbackups (compresses the file called novbackups in the /usr directory)

Options:

-d decompress
-c sends to standard output
-h displays help
-l  displays compressed and uncompressed file sizes
-r directory_name recursively searches for specified directory and compressed all the files in them

You can use the tar and gzip command together to expedite the uncompressing and untaring of files with the tar.gz extension, an example would be untaring and decompressing the kernel with one command.. 

# gzip -cd  linux-2.4.0-test9.tar.gz  |  tar  xvf - 

BACK