List of common decompress & compress tools in unix

For my future reference:  (整理自互联网)

check folder size:

du -sh *


1. 7-zip:  (.7z file)


tar -jxvf p7zip_9.20.1_src_all.tar.bz2
cd p7zip_9.20.1
make install

7za {a|d|l|e|u|x} 压缩包文件名 {文件列表或目录,可选}

a 向压缩包里添加文件或创建压缩包,如向001.7z添加001.jpg,执行:7za a 001.7z 001.jpg;将001目录打包执行:7za a 001.7z 001;
d 从压缩里删除文件,如将001.7z里的001.jpg删除,执行:7za d 001.7z 001.jpg
l 列出压缩包里的文件,如列出001.7z里的文件,执行:7za l 001.7z
e 解压到当前目录,目录结构会被破坏,如001.rar内有如下目录及文件123/456/789.html,
执行:7za e 001.rar,目录123和456及文件789.html都会存放在当前目录下。
x 以完整路径解压。



2. tar:  (decompress)

  1. Type at the command prompt
    tar xvzf file-1.0.tar.gz – to uncompress a gzip tar file (.tgz or .tar.gz)
    tar xvjf file-1.0.tar.bz2 – to uncompress a bzip2 tar file (.tbz or .tar.bz2)
    tar xvf file-1.0.tar – to uncompressed tar file (.tar)
    • x = eXtract, this indicated an extraction c = create to create )
    • v = verbose (optional) the files with relative locations will be displayed.
    • z = gzip-ped; j = bzip2-zipped
    • f = from/to file … (what is next after the f is the archive file)
  2. The files will be extracted in the current folder (most of the times in a folder with the name ‘file-1.0’).

3. tar: (compress)

To tar all .cc and .h files into a tar file named foo.tgz use:

    tar cvzf foo.tgz *.cc *.h

This creates (c) a compressed (z) tar file named foo.tgz (f) and shows the files being stored into the tar file (v). The .tgz suffix is a convention for gzipped tar files, it’s useful to use the convention since you’ll know to use z to restore/extract.

It’s often more useful to tar a directory (which tars all files and subdirectories recursively unless you specify otherwise). The nice part about tarring a directory is that it is untarred as a directory rather than as individual files.

   tar cvzf foo.tgz cps100

will tar the directory cps100 (and its files/subdirectories) into a tar file named foo.tgz.


4. (.bz2) file (Perfect for single file compression)

download bzip2:

parallel bzip2 (MPI version):

bzip2 -d filename.bz2

After decompression, original file will be deleted



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s