tar

UK[tɑ:(r)] US[tɑ:r]

n. Tar, asphalt, asphalt; nicotine;<口> ;Sailor, sailor

vt. To cover or smear (something) with tar or asphalt

Third person singular: tars Plural: tars Present participle: tarring Past tense: tarred

Linux tar command syntax

Function: tar command is used to back up files.

Syntax: tar [-ABcdgGhiklmMoOpPrRsStuUvwWxzZ][-b <number of blocks>][-C <destination directory>][-f <backup file>] [-F <Script file>][-K <File>][-L <Media capacity>][-N <Date time>][-T <Template file>][ -V <Volume Name>][-X <Template File>][-<Device Number><Storage Density>][--after-date=<Date Time>][ --atime-preserve][--backuup=<Backup method>][--checkpoint][--concatenate][--confirmation][--delete][--exclude=<Template style>] [--force-local][--group=<group name>][--help][--ignore-failed-read][--new-volume-script=<Script file>] [--newer-mtime][--no-recursion][--null][--numeric-owner][--owner=<username>][--posix][--erve][- -preserve-order][--preserve-permissions][--record-size=<number of blocks>][--recursive-unlink][--remove-files][--rsh-command=< Execute command>][--same-owner][--suffix=<Backup suffix string>][--totals][--use-compress-program=<Execute command>][- -version][--volno-file=<numbered file>][file or directory...]

Linux tar command example

Compressed file non-packaged

# touch a.c       
# tar -czvf test.tar.gz a.c   //压缩 a.c文件为test.tar.gz
a.c

List compressed file contents

# tar -tzvf test.tar.gz 
-rw-r--r-- root/root     0 2010-05-24 16:51:59 a.c