Tar (computing)

Revision as of 19:34, 27 July 2020 by David (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
\( \newcommand{\P}[]{\unicode{xB6}} \newcommand{\AA}[]{\unicode{x212B}} \newcommand{\empty}[]{\emptyset} \newcommand{\O}[]{\emptyset} \newcommand{\Alpha}[]{Α} \newcommand{\Beta}[]{Β} \newcommand{\Epsilon}[]{Ε} \newcommand{\Iota}[]{Ι} \newcommand{\Kappa}[]{Κ} \newcommand{\Rho}[]{Ρ} \newcommand{\Tau}[]{Τ} \newcommand{\Zeta}[]{Ζ} \newcommand{\Mu}[]{\unicode{x039C}} \newcommand{\Chi}[]{Χ} \newcommand{\Eta}[]{\unicode{x0397}} \newcommand{\Nu}[]{\unicode{x039D}} \newcommand{\Omicron}[]{\unicode{x039F}} \DeclareMathOperator{\sgn}{sgn} \def\oiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x222F}\,}{\unicode{x222F}}{\unicode{x222F}}{\unicode{x222F}}}\,}\nolimits} \def\oiiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x2230}\,}{\unicode{x2230}}{\unicode{x2230}}{\unicode{x2230}}}\,}\nolimits} \)

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