Wednesday, June 11, 2008

Some Tricks with unix command 'Tar'

Most of you might be aware of this very usefull command tar in unix. As per manual it has been read as " an archiving program designed to store and extract files from an archive file known as a tarfile". Here I am not going to give you syntax for this command. But how can you make it more useful in your day to day work. i.e Online compression of tar backup.

For online compress of files with gzip
tar cvf - * : gzip > file_name.tar.gz

For testing backup files
gunzip < file_name.tar.gz : tar tvf -

For extracting files from above compress
gunzip < file_name.tar.gz : tar xvf -

For Online extracting of files from compress tar file, this way no need to uncompress it
zcat file_name.tar.Z : tar xvf -

Make sure to replace colon ":" with pipe sign

Happy Troubleshooting !!!

No comments: