work with tar

tar is tape archive
c- create
v – verbose
f – name of file
# tar cvf /home/user.tar /directoryToBeCreated
# file fileName (show shich kind of file is)
z is for compression to tgz
# tar czf /home/user.tar /directoryToBeCreated
Before check what is in side:
# tar tvf filename
The directory names are relative.
# tar xvf
Ordering is important !!!!
-C switch to specific directory:
# tar xvf archiveName.tar -C /tmp
I’m backup the configuration files and after that If I’m removing a configuration file, I can restore it like this:
# tar xvf /root/etc.tar -C / etc/wgetrc
(I’m using etc/wgetrc in order to extract only a file from archive).