日期:2014-05-16  浏览次数:20740 次

linux命令tar

[root@test flume]# tar --help
Usage: tar [OPTION...] [FILE]...
GNU `tar' saves many files together into a single tape or disk archive, and can
restore individual files from the archive.

Examples:
? tar -cf archive.tar foo bar? # Create archive.tar from files foo and bar.
? tar -tvf archive.tar???????? # List all files in archive.tar verbosely.
? tar -xf archive.tar????????? # Extract all files from archive.tar.

?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

?Operation modifiers:

????? --check-device???????? check device numbers when creating incremental
???????????????????????????? archives (default)
? -g, --listed-incremental=FILE?? handle new GNU-format incremental backup
? -G, --incremental????????? handle old GNU-format incremental backup
????? --ignore-failed-read?? do not exit with nonzero on unreadable files
????? --level=NUMBER???????? dump level for created listed-incremental archive
? -n, --seek???????????????? archive is seekable
????? --no-check-device????? do not check device numbers when creating
???????????????????????????? incremental archives
????? --no-seek????????????? archive is not seekable
????? --occurrence[=NUMBER]? process only the NUMBERth occurrence of each file
???????????????????????????? in the archive; this option is valid only in
???????????????????????????? conjunction with one of the subcommands --delete,
???????????????????????????? --diff, --extract or --list and when a list of
???????????????????????????? files is given either on the command line or via
???????????????????????????? the -T option; NUMBER defaults to 1
????? --sparse-version=MAJOR[.MINOR]
???????????????????????????? set version of the sparse format to use (implies
???????????????????????????? --sparse)
? -S, --sparse?????????????? handle sparse files efficiently

?Overwrite control:

? -k, --keep-old-files?????? don't replace existing files when extracting
????? --keep-newer-files???? don't replace existing files that are newer than
???????????????????????????? their archive copies
????? --no-overwrite-dir???? preserve metadata of existing directories
????? --overwrite??????????? overwrite existing files when extracting
????? --overwrite-dir??????? overwrite metadata of existing directories when
???????????????????????????? extracting (default)
????? --recursive-unlink???? empty hierarchies prior to extracting directory
????? --remove-files???????? remove files after adding them to the archive
? -U, --unlink-first???????? remove each file prior to extracting over it
? -W, --verify?????????????? attempt to verify the archive after writing it

?Select output stream:

????? --ignore-command-error ignore exit codes of children
????? --no-ignore-command-error?? treat non-zero exit codes of children as
???????????????????????????? error
? -O, --to-stdout??????????? extract files to standard output
????? --to-command=COMMAND?? pipe extracted files to another program

?Handling of file attributes:

????? --acls???????????????? Save the ACLs to the archive
????? --atime-preserve[=METHOD]?? preserve access times on dumped files, either
???????????????????????????? by restorin