Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 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 <code bash> tar -cvzf logs.tar.gz /var/log </code> \\ List contents of archive <code bash> tar -tf logs.tar.gz </code> \\ Decompress and unpack at the same time to current directory <code bash> tar -zxvf logs.tar.gz </code> \\ Decompress and unpack at the same time to a different existing directory <code bash> tar -zxvf logs.tar.gz -C /home/rjones/data/ </code> \\ Add a new file to an existing archive <code bash> tar -rvf logs.tar newlog.log </code> ---- linux_wiki/tar.txt Last modified: 2019/05/25 23:50(external edit)