tar命令的第一个参数必须是一个函数名(或者简写),而且只能有一个函数,常见语法如下:
NAME
tar -- The GNU version of the tar archiving utility
SYNOPSIS
tar [-] A --catenate --concatenate | c --create | d --diff --compare | --delete | r --append | t --list | --test-label | u
--update | x --extract --get [options] [pathname ...]
FUNCTION LETTERS
Main operation mode:
-A, --catenate, --concatenate
append tar files to an archive
-c, --create
create a new archive
-d, --diff, --compare
find differences between archive and file system
--delete
delete from the archive (not on mag tapes!)
-r, --append
append files to the end of an archive
-t, --list
list the contents of an archive
--test-label
test the archive volume label and exit
-u, --update
only append files newer than copy in archive
-x, --extract, --get
extract files from an archive
OTHER OPTIONS
Operation modifiers:
-f, --file ARCHIVE
use archive file or device ARCHIVE
-k, --keep-old-files
don't replace existing files when extracting,
-v, --verbose
verbosely list files processed
-w, --interactive, --confirmation
ask for confirmation for every action
-z, --gzip, --gunzip --ungzip
-Z, --compress, --uncompress
EXAMPLES
Create archive.tar from files foo and bar.
tar -cf archive.tar foo bar
List all files in archive.tar verbosely.
tar -tvf archive.tar
Extract all files from archive.tar.
tar -xf archive.tar