tldr/pages/common/tar.md
quarcu 09c2d66923 List content of tar file
List content of tar file. 

I recommend reducing amount of options regarding compressed files since on some OS are allowed only in -c mode.
Basically :
-j : bzip2
-J : xz
-z : bzip2

Additionally the extract should manage as tar -xf file no matter which compression.
2014-09-10 00:45:57 +01:00

676 B

tar

Archiving utility Optional compression with gzip / bzip

  • create an archive from files

tar cf {{target.tar}} {{file1 file2 file3}}

  • create a gzipped archive

tar czf {{target.tar.gz}} {{file1 file2 file3}}

  • extract an archive in a target folder

tar xf {{source.tar}} -C {{folder}}

  • extract a gzipped archive in the current directory

tar xzf {{source.tar.gz}}

  • extract a bzipped archive in the current directory

tar xjf {{source.tar.bz2}}

  • create a compressed archive, using archive suffix to determine the compression programm

tar caf {{target.tar.xz}} {{file1 file2 file3}}

  • list the contents of a tar file

tar -tvf {{source.tar}}