linux 打包压缩 (4)

ZIP压缩包

zip -r ./public ./wwwroot/
  • 将当前目录中的 wwwroot 目录压缩并将其命名为  public 
  • -r 代表将指定的目录下的所有子目录以及文件一起处理
  • 如果没有  zip 则需要先安装  yum install -y zip 

查看zip压缩包中内容

unzip -l public.zip
  • 查看  public.zip 压缩包中的内容
  • 如果没有  unzip 则需要先安装  yum install -y unzip  

解压zip包

unzip public.zip
  • 解压  public.zip 
unzip react-app.zip -d ./wwwroot/react/
  • 将  react-app.zip 解压到  ./wwwroot/react/ 

创建tar包

  •  linux 下最常用的打包程序是 tar ,使用 tar 程序打出来的包通常称为 tar 包
  •  生成 tar 包后,就可以用其它程序来进行压缩
tar cvf ./react-app.tar ./react-app
  • 将当前 react-app 文件夹打包成  react-app.tar 
  • -c  建立一个压缩档案的参数指令
  • -v  压缩的过程中显示的档案
  • -f  使用档名 在f后要立即接档名 不要加参数

将tar包解压

tar xvf ./react-app.tar
  • 将当前 react-app.tar 包解压
  • x 代表解开一个压缩档案的参数
  • v 代表解压过程中显示档案
  • f 档名

制作 gz 包

tar czvf ./react-app.tar.gz ./react-app.tar
  • 制作  gz 包需要先将其转换为  tar 包
  • 将  react-app.tar 制作成  react-app.tar.gz 
  • z 代表是否同时具有gizp的属性

查看 gz 包

tar tf ./react-app.tar.gz

解压 gz 包

tar xzvf ./react-app.tar.gz

xz压缩包

xz react-app.tar
  • 制作  xz 包需要先将其转换成  tar 包
  • 制作成  xz  包后会自动删除  tar 包
  • 保留以前的  tar 则需要添加参数  xz -k react-app.tar 

解压 xz 包

xz -d react-app.tar.xz
  • 转换成  tar 包后会自动删除  xz 包
  • 保留原来的  xz 包, xz -dk react-app.tar.xz 
posted @ 2021-11-15 21:56  霸哥yyds  阅读(103)  评论(0)    收藏  举报