Saturday, August 13, 2016

Zip, Archive, Compress and Extract

Command

Zip :- When you compress file into zip format the keep original as it

To compress all file and directory in ZIP
# zip –r archive file name .
#zip –r archive file name foldername/*

To Compress single file in zip
# zip –r archive file name file name

To Extract file
                # unzip archive file name.zip

gzip :-

To compress all file and directory in ZIP
                # gzip file name  è output is file name.gz
                # gzip –c filename >filename.gz è to keep original file as it
                # gzip –r folder name è to compress folder in gzip format
               
To extract file/directory
                # gungip –r filr/directory name

tar:-

                -c è for Create Archive
                -x è for Extract the Archive
                -f è for archive with giving new filename
                -t è for displays or list in archive file
                -u è for archive & add to an existing archive file
                -v è for Display Verbose Information 
                -Z , -gzip, -unzip è Filter the archive through gzip

To archive file
                # tar –cf archive file name.tar file name
                # tar –cf archive file name.tar file name file name1 file name2 file name3 è for multiple files
                # tar –czf archive file name.tgz file nameè to archive in tar gz (gzip) format
# tar -cf home.tar home/ è       create a tar file named home.tar containing the home directory and place that file in the current director
                # tar –czf filename.tgz filename - - remove  è to remove original file and make filename.tgz file

To Extract Fife
                # tar –xzvf filename.tgz è to extract tgz file
                # tar –xvf filename.tar è to extract simple tar file
                # tar – xvzf filename.tgz è to Extract file in special older

bzip

To compress file in .bz2 format 
# bzip2 filename
# bzip2 –c filename >archive file name.bz2 è to keep original file as it

To Extract file

                # bunzip2 archive file name.bz2

No comments:

Post a Comment