解压 tar 文件

  1. [root@liqiang.io]# tar -xf prometheus.tar
  2. [root@liqiang.io]# tar -xf prometheus.tar -C /tmp/prometheus # 指定解压目录
  3. [root@liqiang.io]# tar -zxf prometheus.tar.gz # gzip 类型
  4. [root@liqiang.io]# tar -zxvf prometheus.tar.gz # 查看解压过程

打包 tar 文件

  1. [root@liqiang.io]# tar -cf prometheus.tar /etc/prometheus # 普通打包
  2. [root@liqiang.io]# tar -cf prometheus.tar /etc/prometheus /usr/bin/prometheus # 多个文件
  3. [root@liqiang.io]# tar -zcf prometheus.tar.gz /etc/prometheus # 带 gzip 压缩
  4. [root@liqiang.io]# tar -zcvf prometheus.tar.gz /etc/prometheus # 查看打包过程

分割 tar 包

  1. [root@liqiang.io]# split -b 1024M -d -a 1 prometheus.tar.gz prometheus.tar.gz.

分割后的解压

  1. [root@liqiang.io]# cat prometheus.tar.gz.* | tar -zx