tar command with simples examples

Intro

According to wikipedia, 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.

Extract

user@host $ tar -tz -f archive.tar.gz
user@host $ tar -xzvf archive.tar.gz -C /a/folder
user@host $ tar -xzvf archive.tar.gz "./arch/file01" "./arch/file02"

Create

root@host:~# apt-get install lzip
user@host $ tar --lzip -cvf archive.tar.lz /a/folder/*
user@host $ tar -cvf archive.tar /a/folder/*
user@host $ tar -czvf archive.tar.gz /a/folder/*
root@host~# tar cpjf backup.tgz /etc /var/log
root@host~# tar -jcvf - /my/fodler/ | ssh root@10.0.0.124 "cat > /backup/$(date +%Y.%m.%d)_backup.tgz"
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :