|
发表于 2004-9-11 01:02:02
|
显示全部楼层
[php]
jia@hua:/etc$ tar --help
GNU“tar”将许多文件保存到一个磁带或磁盘归档文件中,
并可以从归档文件中恢复各个文件。
用法:tar [选项]... [文件]...
示例:
tar -cf archive.tar foo bar # 从文件 foo 和 bar 创建归档文件 archive.tar。
tar -tvf archive.tar # 详细列举归档文件 archive.tar 中的所有文件。
tar -xf archive.tar # 解析归档文件 archive.tar 中的所有文件。
如果长选项表明参数是必需的,那么对等价的短选项
来说它同样是必需的。对可选的参数来说也类似。
主要操作模式:
-t, --list 列出归档文件内容目录
-x, --extract, --get 从归档文件中解析文件
-c, --create 创建新的归档文件
-d, --diff, --compare 找出归档文件和文件系统的不同之处
-r, --append 将文件附加到归档文件之后
-u, --update 只附加比归档中新的文件
-A, --catenate 将 tar 文件附加到归档文件之后
--concatenate 与 -A 相同
--delete 从归档文件中删除 (不能在磁带上!)
Operation modifiers:
-W, --verify attempt to verify the archive after writing it
--remove-files remove files after adding them to the archive
-k, --keep-old-files don't replace existing files when extracting
--overwrite overwrite existing files when extracting
--no-overwrite-dir preserve metadata of existing directories
-U, --unlink-first remove each file prior to extracting over it
--recursive-unlink empty hierarchies prior to extracting directory
-S, --sparse handle sparse files efficiently
-O, --to-stdout extract files to standard output
-G, --incremental handle old GNU-format incremental backup
-g, --listed-incremental=FILE
handle new GNU-format incremental backup
--ignore-failed-read do not exit with nonzero on unreadable files
--occurrence[=NUM] process only the NUMth 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 -T option.
NUM defaults to 1.
处理文件属性:
--owner=NAME 将被添加的文件所有者设置为 NAME
--group=NAME 将被添加的文件所属的组设置为 NAME
--mode=CHANGES 将被添加的文件的属性设置为 CHANGES
--atime-preserve 不要改变输出文件的访问时间
-m, --modification-time 不要解析文件的修改时间
--same-owner 试图以相同的所有权解析文件
--no-same-owner 以您自己的身份解析文件
--numeric-owner 总是用编号作为用户/组的名字
-p, --same-permissions 解析许可权限信息
--no-same-permissions 不要解析许可权限信息
--preserve-permissions 与 -p 相同
-s, --same-order 对要解析的名称进行排序以便与归档匹配
--preserve-order 与 -s 相同
--preserve 与 -p 和 -s 都相同
设备选择与切换:
-f, --file=ARCHIVE 使用归档文件或设备 ARCHIVE
--force-local 即使含有冒号,归档文件也是本地文件
--rsh-command=COMMAND 用远程 COMMAND 代替 rsh
-[0-7][lmh] 指定驱动器和密度
-M, --multi-volume 创建/列举/解析多卷归档文件
-L, --tape-length=NUM 在写入 NUM x 1024 个字节后更换磁带
-F, --info-script=FILE 在每个磁带末端运行脚本 (隐含 -M)
--new-volume-script=FILE 与 -F FILE 相同
--volno-file=FILE 使用/更新 FILE 中的卷编号
设备分块:
-b, --blocking-factor=BLOCKS 每个记录 BLOCKS x 512 个字节
--record-size=SIZE 每个记录 SIZE 个字节,512 的倍数
-i, --ignore-zeros 忽略归档中全为零的块 (标示文件结束)
-B, --read-full-records 当我们读入时重新分块 (为 4.2BSD 管道提供)
Archive format selection:
--format=FMTNAME create archive of the given format.
FMTNAME is one of the following:
v7 old V7 tar format
oldgnu GNU format as per tar <= 1.12
gnu GNU tar 1.13 format
ustar POSIX 1003.1-1988 (ustar) format
posix POSIX 1003.1-2001 (pax) format
--old-archive, --portability same as --format=v7
--posix same as --format=posix
--pax-option keyword[[:]=value][,keyword[[:]=value], ...]
control pax keywords
-V, --label=NAME create archive with volume name NAME
PATTERN at list/extract time, a globbing PATTERN
-j, --bzip2 filter the archive through bzip2
-z, --gzip, --ungzip filter the archive through gzip
-Z, --compress, --uncompress filter the archive through compress
--use-compress-program=PROG filter through PROG (must accept -d)
Local file selection:
-C, --directory=DIR change to directory DIR
-T, --files-from=NAME get names to extract or create from file NAME
--null -T reads null-terminated names, disable -C
--exclude=PATTERN exclude files, given as a PATTERN
-X, --exclude-from=FILE exclude patterns listed in FILE
--anchored exclude patterns match file name start (default)
--no-anchored exclude patterns match after any /
--ignore-case exclusion ignores case
--no-ignore-case exclusion is case sensitive (default)
--wildcards exclude patterns use wildcards (default)
--no-wildcards exclude patterns are plain strings
--wildcards-match-slash exclude pattern wildcards match '/' (default)
--no-wildcards-match-slash exclude pattern wildcards do not match '/'
-P, --absolute-names don't strip leading `/'s from file names
-h, --dereference dump instead the files symlinks point to
--no-recursion avoid descending automatically in directories
-l, --one-file-system stay in local file system when creating archive
-K, --starting-file=NAME begin at file NAME in the archive
--strip-path=NUM strip NUM leading components from file names
before extraction
-N, --newer=DATE-OR-FILE only store files newer than DATE-OR-FILE
--newer-mtime=DATE compare date and time when data changed only
--after-date=DATE same as -N
--backup[=CONTROL] 在删除前备份,选择版本控制
--suffix=SUFFIX 在删除前备份,覆盖常用后缀
Informative output:
--help print this help, then exit
--version print tar program version number, then exit
-v, --verbose verbosely list files processed
--checkpoint print directory names while reading the archive
--check-links print a message if not all links are dumped
--totals print total bytes written while creating archive
--index-file=FILE send verbose output to FILE
-R, --block-number show block number within archive with each message
-w, --interactive ask for confirmation for every action
--confirmation same as -w
Compatibility options:
-o when creating, same as --old-archive
when extracting, same as --no-same-owner
除非以 --suffix 或 SIMPLE_BACKUP_SUFFIX 设置备份后缀,否则备份后缀就是“~”。
可以用 --backup 或 VERSION_CONTROL 设置版本控制,可能的值为:
t, numbered 进行编号备份
nil, existing 如果编号备份存在则进行编号备份,否则进行简单备份
never, simple 总是使用简单备份
ARCHIVE may be FILE, HOST:FILE or USER@HOST:FILE; DATE may be a textual date
or a file name starting with `/' or `.', in which case the file's date is used.
*This* `tar' defaults to `--format=gnu -f- -b20'.
Report bugs to <bug-tar@gnu.org>.
....
[/php] |
|