Tar

Tar with compression

The Unix tar command

# tar -cvzf foo.tgz cps100

will tar the directory cps100 (and its files/subdirectories) into a tar file named foo.tgz.

To see a tar file's table of contents use:

# tar -tzf foo.tgz

Extract Tar or UnTar gzip files

To extract the contents of a tar file use (works with both .tar and .gz files):

# tar -xvzf foo.tgz

This untars/extracts (x) into the directory from which the command is invoked, and prints the files being extracted (v).

 

Tar without compression

To combine multiple files and/or directories into a single file, use the following command:

tar -cvf file.tar inputfile1 inputfile2

To separate an archive created by tar into separate files, at the shell prompt, enter:

tar -xvf file.tar

 

See Also

rcp

rsync


Subject