Linux tar command
Linux tar command to back up files.
tar is used to create, restore a backup file utility, which can be added to unlock the files within the backup file.
grammar
tar [-ABcdgGhiklmMoOpPrRsStuUvwWxzZ][-b <区块数目>][-C <目的目录>][-f <备份文件>][-F <Script文件>][-K <文件>][-L <媒体容量>][-N <日期时间>][-T <范本文件>][-V <卷册名称>][-X <范本文件>][-<设备编号><存储密度>][--after-date=<日期时间>][--atime-preserve][--backuup=<备份方式>][--checkpoint][--concatenate][--confirmation][--delete][--exclude=<范本样式>][--force-local][--group=<群组名称>][--help][--ignore-failed-read][--new-volume-script=<Script文件>][--newer-mtime][--no-recursion][--null][--numeric-owner][--owner=<用户名称>][--posix][--erve][--preserve-order][--preserve-permissions][--record-size=<区块数目>][--recursive-unlink][--remove-files][--rsh-command=<执行指令>][--same-owner][--suffix=<备份字尾字符串>][--totals][--use-compress-program=<执行指令>][--version][--volno-file=<编号文件>][文件或目录...]
Parameters:
- -A --catenate Or add files to the backup file that already exists.
- -b <block number> or --blocking-factor = <block number> to set the number of blocks per record, each block size 12Bytes.
- -B Or --read-full-records reset block size when reading data.
- -c --create or create a new backup file.
- -C <Destination directory> or --directory = <destination directory> switch to the specified directory.
- Differences within the file or -d or --diff --compare contrast and backup files on the file system.
- -f <backup file> or --file = <backup file> Specify the backup file.
- -F <Script file> or --info-script = <Script file> When changing the tape, on the implementation of the specified Script file every time.
- -g or --listed-incremental backup of a large number of processing GNU format.
- -G Or --incremental handle large backups old GNU format.
- -h or --dereference not create a symbolic link, a direct copy of the connection points to the original file.
- -i or --ignore-zeros ignore the backup file 0 Byte block, which is EOF.
- When -k or --keep-old-files unlock backup file does not overwrite the existing file.
- -K <File> or --starting-file = <file> Start Restore from the specified file.
- -l --one-file-system or copy a file or directory is stored in the file system, when the tar command must be executed with the file system in which the same, or not copied.
- -L <Media capacity> or -tape-length = <media capacity> Settings storage capacity of each member of the unit to 1024 Bytes calculations.
- -m or --modification-time to restore a file, the file does not change the time change.
- -M Or --multi-volume in the establishment, restore a backup file or list the contents, multi-mode volumes.
- -N <Date format> or --newer = <datetime> than the specified date will only save the updated file to the backup file.
- -o or --old-archive or --portability use V7 format to write data to the backup file.
- -O Or --stdout restore the file from a backup file to the standard output device.
- -p or --same-permissions to use the original file permissions to restore files.
- -P --absolute-Names or file names use absolute name, without removing the "/" sign in front of the file name.
- End of the -r or --append add files to an existing backup file.
- -R Or --block-number information is listed for each block in the backup file number.
- -s --same-Order or order to restore files and store the backup file in the same order.
- -S Or --sparse if a file containing a large number of consecutive 0 bytes, then save the file as a sparse file.
- -t or --list list the contents of the backup file.
- -T <Template file> or --files-from = <template file> Specifies the template file, which contains one or more inner template styles, so tar untied or establish compliance with the conditions set files.
- -u or --update only files than the backup file replacement within the updated files.
- Before -U or --unlink-first unzip the file to restore the file, the file before undocking.
- -v or --verbose display during the execution of instructions.
- -V <Album name> or --label = <album name> established using the specified volumes backup file name.
- -w or --interactive first asking the user when confronted with problems.
- After -W or --verify write the backup file to ensure correct.
- -x or --extract --get or restore files from the backup file.
- -X <Template file> or --exclude-from = <template file> Specifies the template file, which contains one or more inner template styles, so ar exclude meet the conditions set file.
- -z or --gzip or --ungzip handle the backup files by gzip command.
- -Z Or --compress or --uncompress handle the backup files compress command.
- - <Device number> <storage density> Set Peripherals number backup and storage of data density.
- --after-date = <date time> effect of this parameter and specify "-N" the same parameters.
- --atime-preserve do not change the access time of the file.
- before --backup = <backup> --backup or remove files to backup.
- --checkpoint List directory names while reading the backup file.
- --concatenate effects and specify this parameter "-A" parameters the same.
- --confirmation effect of this parameter and specify "-w" the same parameters.
- --delete delete the specified file from the backup file.
- --exclude = <style template> template style conform to exclude asked the home.
- --group = <Group Name> was added to the files in the device of their group set to the specified group.
- --help online help.
- --ignore-failed-read ignore the data read errors, without interrupting the execution of the program.
- --new-volume-script = <Script file> effect of this parameter and specify "-F" parameters the same.
- --newer-mtime save only files that have changed.
- --no-recursion do recursive processing, that is, all the files and subdirectories in the specified directory will not be processed.
- --null name from the null device to read files.
- --numeric-owner user identification code and group identification code and replace the user name group name.
- --owner = <user name> is added to the backup file in the file owner set to specified users.
- --posix data using POSIX format when writing the backup file.
- --preserve effect of this parameter and specify "-ps" the same parameters.
- And designated --preserve-order effect of this parameter "-A" parameters the same.
- Effects and designated --preserve-permissions for this parameter "-p" the same parameters.
- --record-size = <block number> effect of this parameter and specify "-b" the same parameters.
- Before --recursive-unlink Extract the file to restore the directory, first undocking of all files under the entire directory.
- After --remove-files file in a backup file, it will be deleted.
- --rsh-command = <Instruction> set of instructions to be executed on the remote host to replace rsh command.
- --same-owner tries to restore the same file owner asks you home.
- --suffix = <backup suffix string> before removing the file is backed up.
- After --totals backup file is created, listing the file size.
- --use-compress-program = <Instruction> processing instructions specified by the backup file.
- --version display version information.
- --volno-file = <file number> Use number within the specified file instead of the default number of volumes.
Examples
Compressed files unpacked
# touch a.c # tar -czvf test.tar.gz a.c //压缩 a.c文件为test.tar.gz a.c
Lists the contents of compressed files
# tar -tzvf test.tar.gz -rw-r--r-- root/root 0 2010-05-24 16:51:59 a.c
unzip files
# Tar -xzvf test.tar.gz ac