tar & gzip

tar

#create
tar cvf archive_name.tar dirname/
#estimates the tar file size ( in KB ) before you create the tar file.
$ tar -cf - /directory/to/archive/ | wc -c
20480

#extract
tar xvf archive_name.tar  [destPath1] [destPath2]
#extract archives using regular expression
tar xvf archive_file.tar --wildcards '*.pl'
#Adding a file or directory to an existing archive, 
#Note: You cannot add file or directory to a compressed archive, for instance '.tgz'
tar rvf archive_name.tar newfileOrnewdir

#show
tar tvf archive_name.tar 
less archive_name.tar 



#c – create a new archive
#v – verbosely list files which are processed.
#f – following is the archive file name
#z – filter the archive through gzip
#j – filter the archive through bzip2
#–wildcards *.pl – files with pl extension
#r - Adding a file or directory to an existing archive 
-W Verify files available in tar 

gzip

gunzip

bzip2

创建*.bz2压缩文件

解压*.bz2文件

更多示例:BZ is Eazy! bzip2, bzgrep, bzcmp, bzdiff, bzcat, bzless, bzmore examples

uzip

解压*.zip文件

查看*.zip文件的内容

Last updated