본문 바로가기

서버 | OS/Linux - Shell Script

한줄로 tar + gzip 압축 진행상태 모니터링

Compress

tar cf - <files> -P | pv -s $(du -sb <files> | awk '{print $1}') | gzip > <some .tar.gz file>

where:

  • <files> is the root-mounted (i.e. starts with /) path to the files
  • <some .tar.gz file> is the output tarball to create

Decompress

pv <some .tar.gz file> | tar -xvzf - -C <some directory>

where:

  • <some .tar.gz file> is the path to the tarball to extract
  • <some directory> is the directory to extract the tarball to

Source : https://gist.github.com/Kautenja/tar-progress.md