
1. Files with the .a extension: #tar xv file.a
2. Files with the .z extension: #uncompress file.Z
3. Files with the .gz extension: #gunzip file.gz
4. Files with the .bz2 extension: #bunzip2 file.bz2
5. Files with the .tar.Z extension: #tar xvZf file.tar.Z or #compress -dc file.tar.Z | tar xvf
6. Files with the .tar.gz/.tgz extension: #tar xvzf file.tar.gz or gzip -dc file.tar.gz | tar xvf -
7. Files with the .tar.bz2 extension: #tar xvIf file.tar.bz2 or bzip2 -dc file.tar.bz2 | xvf –
8. Files with the .cpio.gz/.cgz extension: #gzip -dc file.cgz | cpio -div
9. Files with the .cpio/cpio extension: #cpio -div file.cpio or cpio -divc file.cpio
10. Installing files with the .rpm extension: #rpm -i file.rpm
11. Extracting files with the .rpm extension: #rpm2cpio file.rpm | cpio -div
12. Installing files with the .deb extension: #dpkg -i file.deb
13. Extracting files with the .deb extension: #dpkg-deb —fsys-tarfile file.deb | tar xvf - ar p file.deb data.tar.gz | tar xvzf –
14. Files with the .zip extension: #unzip file.zip
15. Extracting Winzip-format files under Linux: if you have the JDK installed you can use the jar command; the unzip command works too.
16. Extracting a .tar.gz file directly: for an xxxx.tar.gz file, use tar with the zxvf options and it will unpack in one go. XXXX is the file name. For example: $tar zxvf xxxx.tar.gz Extraction (and install methods) for all kinds of compressed files
17. Extraction by file extension (install methods): .a ar xv file.a .Z uncompress file.Z .gz gunzip file.gz .bz2 bunzip2 file.bz2 .tar.Z tar xvZf file.tar.Z compress -dc file.tar.Z | tar xvf - .tar.gz/.tgz tar xvzf file.tar.gz gzip -dc file.tar.gz | tar xvf - .tar.bz2 tar xvIf file.tar.bz2 bzip2 -dc file.tar.bz2 | xvf - .cpio.gz/.cgz gzip -dc file.cgz | cpio -div .cpio/cpio cpio -div file.cpio cpio -divc file.cpio .rpm/install rpm -i file.rpm .rpm/extract rpm2cpio file.rpm | cpio -div .deb/install dpkg -i file.deb .deb/exrtact dpkg-deb —fsys-tarfile file.deb | tar xvf - ar p file.deb data.tar.gz | tar xvzf - .zip unzip file.zip bzip2 -d myfile.tar.bz2 | tar xvf
18.tar xvfz myfile.tar.bz2 x is for extract, v is verbose output, f specifies the file, z is the gz format
19.gzip gzip[options]the name of the file to compress (or decompress) -c writes the output to standard output and keeps the original file. -d decompresses the compressed file. -l for each compressed file, displays the following fields: the size of the compressed file, the size of the uncompressed file, the compression ratio, and the name of the uncompressed file -r recursively searches the specified directory and compresses or decompresses all the files in it. -t tests whether the compressed file is intact. -v for each file compressed or decompressed, displays its filename and compression ratio. -num- adjusts the compression speed with the specified number.
20. Examples: back up every file in the /usr directory, including its subdirectories, with the backup file named usr.tar tar cvf usr.tar /home back up every file in the /usr directory, including its subdirectories, and compress it, with the backup file named usr.tar.gz tar czvf usr.tar.gz /usr compress a group of files, with the suffix tar.gz #tar cvf back.tar /back/ #gzip -q back.tar or #tar cvfz back.tar.gz /back/ unpack a file with the tar.gz suffix. #tar zxvf back.tar.gz #gzip back.tar.gz #tar xvf back.tar

