tar compress examples

Example 1: how to tar linux

tar -zcvf file.tar.gz /path/to/dir/

Example 2: tar compress

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Example 3: tar cmd

# tar -cvf tecmint-14-09-12.tar /home/tecmint/

/home/tecmint/
/home/tecmint/cleanfiles.sh
/home/tecmint/openvpn-2.1.4.tar.gz
/home/tecmint/tecmint-14-09-12.tar
/home/tecmint/phpmyadmin-2.11.11.3-1.el5.rf.noarch.rpm
/home/tecmint/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

Example 4: tar cmd

# tar cvzf MyImages-14-09-12.tar.gz /home/MyImages
OR
# tar cvzf MyImages-14-09-12.tgz /home/MyImages

Tags:

C Example