Difference between revisions of "Tar (computing)"

From David's Wiki
Jump to navigation Jump to search
(Created page with "tar is a program for creating archives. tar archives, or tarballs, preserve unix permissions of multiple files or folders. By default, a .tar file is not compressed. Typic...")
(No difference)

Revision as of 15:34, 27 July 2020

tar is a program for creating archives.
tar archives, or tarballs, preserve unix permissions of multiple files or folders.
By default, a .tar file is not compressed. Typically you'll see .tar.gz, or .tgz which denotes a tar file compressed using gzip.

Getting Started

Extraction
tar xzvf archive.tar.gz
Archive
tar czpvf archive.tar.gz files
Flags
  • -x extract preserving paths
  • -p preserve permissions
  • -c create an archive
  • -f specify file
  • -C output dir
Compression formats
  • -z use gzip
  • -j use bzip2
  • -J use xz
  • -I pigz use pigz (parallel gz)

Progress Bar

Reference

Tar does not give you a progress bar by default. You can get a progress bar by piping tar through pv:

tar cf - $folder | pv -s $(du -sb $folder | awk '{print $1}') | pigz > $folder.tar.gz