----------------------------------------------------------------------------------------
zip
------------
压缩一个目录:
zip -r archive_name.zip directory_to_compress
解压一个zip文档:
unzip filename.zip -d /path/to/directory
如果您想在没有提示的情况下覆盖现有文件,请使用-o 选项:
unzip -o filename.zip
解压 ZIP 文件而不改写现有文件,使用-n 选项强制 unzip 跳过提取已经存在的文件:
unzip -n filename.zip
----------------------------------------------------------------------------------------
tar
------------
打包一个目录:
tar -cvf archive_name.tar directory_to_compress
如何解包:
tar -xvf archive_name.tar
更换解包的路径:
tar -xvf archive_name.tar -C /tmp/extract_here/
----------------------------------------------------------------------------------------
tar.gz
------------
压缩一个目录:
tar -zcvf archive_name.tar.gz directory_to_compress
解压缩:
tar -zxvf archive_name.tar.gz
更换解包的路径:
tar -zxvf archive_name.tar.gz -C /tmp/extract_here/
----------------------------------------------------------------------------------------
tar.bz2
------------
进行压缩。
tar -jcvf archive_name.tar.bz2 directory_to_compress
更换解包的路径:
tar -jxvf archive_name.tar.bz2 -C /tmp/extract_here/
节选自:https://www.cnblogs.com/nyist-xsk/p/7929859.html
网友评论