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...")
 
 
Line 30: Line 30:
 
[https://superuser.com/questions/168749/is-there-a-way-to-see-any-tar-progress-per-file Reference]
 
[https://superuser.com/questions/168749/is-there-a-way-to-see-any-tar-progress-per-file Reference]
  
Tar does not give you a progress bar by default.
+
Tar does not provide a progress bar.
 
You can get a progress bar by piping tar through <code>pv</code>:
 
You can get a progress bar by piping tar through <code>pv</code>:
 
<pre>
 
<pre>
 
tar cf - $folder | pv -s $(du -sb $folder | awk '{print $1}') | pigz > $folder.tar.gz
 
tar cf - $folder | pv -s $(du -sb $folder | awk '{print $1}') | pigz > $folder.tar.gz
 
</pre>
 
</pre>

Latest revision as of 15:35, 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 provide a progress bar.
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