search on lynty.com

Related Articles

tar

Print PDF


### TAR BACKUP EXCUDE DIRECROTY BACKUP YOU DONT WANT TO BACKUP ###


tar --exclude=/home/evan/My_Music -cvfpj tarFile.bz2 /home/evan/

IT IS VERY IMPOTANT TO RIHWTH THE '-' SYMBOLY WHEN YOU ARE TYPYING -CVJPF tarFile.bz2 /home/evan/

 

 

Tar Extract a Single File(s) From a Large Tarball

Extracting Specific Files

Extract a file called etc/default/sysstat from config.tar.gz tarball:

$ tar -ztvf config.tar.gz
$ tar -zxvf config.tar.gz etc/default/sysstat
$ tar -xvf {tarball.tar} {path/to/file}


or

tar --extract --file={tarball.tar} {file}


Extract a directory called sam from file.tar:

$ tar --extract --file=file.tar sam


Wildcard based extracting

You can also extract those files that match a specific globbing pattern (wildcards). For example, to extract from cbz.tar all files that begin with pic, no matter their directory prefix, you could type:

$ tar -xf cbz.tar --wildcards --no-anchored 'pic*'

To extract all php files, enter:

$ tar -xf cbz.tar --wildcards --no-anchored '*.php'

 

Where,

* -x: instructs tar to extract files.
* -f: specifies filename / tarball name.
* -v: Verbose (show progress while extracting files).
* -j : filter archive through bzip2, use to decompress .bz2 files.
* -z: filter archive through gzip, use to decompress .gz files.
* --wildcards: instructs tar to treat command line arguments as globbing patterns.
* --no-anchored: informs it that the patterns apply to member names after any / delimiter.

 







 

 

 

 

 

Related Articles+