Tar

From TBP Wiki
Jump to: navigation, search

In computing, tar is a computer software utility for collecting many files into one archive file, often referred to as a tarball, for distribution or backup purposes. The name is derived from tape archive, as it was originally developed to write data to sequential I/O devices. The archive data sets created by tar contain various file system parameters, such as time stamps, ownership, file access permissions, and directory organization. The file structure to store this information was later standardized in POSIX.1-1988 and later POSIX.1-2001. and became a format supported by most modern file archiving systems.

Create a tar.gz

   tar -cf archive.tar.gz /home/username/folder

Extract tar.gz

   tar xvzf file.tar.gz

Extract tar.bz2

   tar xjf file.tar.bz2

Extract .tar

   tar xf file.tar

To see the contents of a tar.gz file without extracting it:

   tar -tf filename.tar.gz

Extract specific file "etc/default/filename.sql" from tarball example.tar.gz

   tar -zxvf example.tar.gz etc/default/filename.sql