Create an archive To create an archive of the entire test directory, issue the following command:

Compress the Files or Directory with gzip

Compress the Files or Directory with bzip2

If you want to include into your archive several different directories you might use the following command:

where the -I option specifies the name of a file with a list of directories and files that you want to include into your archive.
Also, it’s possible to exclude certain files and directories from your archive:

List an archive contents To list the contents of your archive issue the following command:

Extract from an archive To extract the contents of your archive:

Note, that everything will be extracted exactly at the same location from where it was taken. If some directories do no exist then they will be created.
Legend of tar’s options c – add to archive, using an absolute path x – extract from archive t – read the contents of an archive f – you work with a file, otherwise it’s a tape p – preserve file’s permissions and modes v – verbose, display the result -I – use an include list X – use an exclude list

> tar –help

About Gugulethu Ncube

IT enthusiast getting things done.