Loading...
 

Tar

The GNU version of the tar archiving utility

Examples

Just some examples of common tar usage. See the man page for full syntax. Add the -z parameter to any of these examples to create a gzipped tar file but be aware that you can't append any files to the archive in that format. You would need to first gunzip the tar file then append files then gzip it again.

Create a tar file based on the contents of a directory
tar -cvf /somepath/myarchive.tar /home

Create a tar file based on the contents of a directory, excluding some directories
tar -cvf /somepath/myarchive.tar --exclude "/someuser/Desktop" /home

Backup your root file system
tar -cpvf /somepath/myarchive.tar --exclude "/proc" --exclude "/mnt" --exclude "/dev" /

Pipe the contents of find to create a tar archive
find /etc -iname *.conf | xargs tar -rvf /somepath/myarchive.tar

Show php error messages