====== Tar ====== **General Information** Tar archiving utility. **Checklist** * Distro(s): Any ---- ====== Tar Options ====== Options * -c => create new archive * -t => list contents of archive * -x => extract files from archive * -z => compress or decompress in gzip (depending upon if -x or -c was also passed) * -v => display files as they are processed * -j => use bzip2 * -r => append/add file to the end of the existing archive * -u => update a file in an existing archive if the source is newer * -f => archive filename * --selinux => include selinux contexts ---- ====== Tar Examples ====== Archive and compress (using gzip) the /var/log directory tar -cvzf logs.tar.gz /var/log \\ List contents of archive tar -tf logs.tar.gz \\ Decompress and unpack at the same time to current directory tar -zxvf logs.tar.gz \\ Decompress and unpack at the same time to a different existing directory tar -zxvf logs.tar.gz -C /home/rjones/data/ \\ Add a new file to an existing archive tar -rvf logs.tar newlog.log ----