-c, --create Create a new archive. Arguments supply the names of the files to be archived.
-x, --extract, --get Extract files from an archive.
-z, --gzip, --gunzip, --ungzip Filter the archive through gzip(1).
-j, --bzip2 Filter the archive through bzip2(1).
-f, --file=ARCHIVE Use archive file or device ARCHIVE. If this option is not given, tar will first examine the environment variable `TAPE'. If it is set, its value will be used as the archive name. Otherwise, tar will assume the compiled-in default.
-t, --list List the contents of an archive.
-v, --verbose Verbosely list files processed.
打包
不压缩
tar cvf filename.tar filename
压缩
tar czvf filename.tgz filename
tar cjvf filename.tbz2 filename
解包
不压缩
tar xvf filename.tar
压缩
tar xzvf filename.tgz
tar xjvf filename.tbz2
解包到指定目录
tar xf filename.tar -C dir
tar xf filename.tar --one-top-level=dir
查看包里的文件
tar tf filename.tar
参考资料