tar command code example

Example 1: linux tar zip folder

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

Example 2: how to tar linux

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

Example 3: tar.gz terminal

tar -xzvf archive.tar.gz

Example 4: how to tar

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

Example 5: linux tar command

Create a new tar archive.
$ tar cvf archive_name.tar dirname/

Extract from an existing tar archive.
$ tar xvf archive_name.tar

View an existing tar archive.
$ tar tvf archive_name.tar

Example 6: 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

Tags:

Misc Example