Linux Archive Tool---Tar

Source: Internet
Author: User
Tags posix save file

      

Tar instruction usage: tar [-][options] [pathname ...]

Main mode of operation:

-A,--catenate,--concatenate

      

-c,--create: Creating an Archive

-d,diff,compare: Comparing the difference between an archive file and an operating system

--delete: Remove from archive (note that here--not a common description tag, same as-c,-d)

-r,--append: Recursive operation

-t,--list: list, listing files in archive (do not expand direct view of archive files)

--test-table: Test paper label archive and exit

-u,--update: Just add a new file to the archive

-X,--extract,--get: Expand Archive

Additional operation options:

-[0-7]: Different archive compression rates (the smaller the compressed file, the more hard disk space is saved, but it means that the longer it takes to compress)

-A,--auto-compress: Use the archive suffix name to determine the compression algorithm

--add-file=file: Add a file to the archive (if its name starts with--it's very useful)

--anchored: File name start pattern match

--no-anchored: Default starting from "/" match

--atime-preserve: Save file access time

--no-auto-compress: The compression algorithm is not determined using the file suffix name

-B,--blocking-factor: Specify block BLOCKS X 512

-B,--read-full-records: Specify block again in the way we read

--Backup: Pre-delete, for version selection

-C,--Directory DIR: Change storage path

--check-device: Check the number of devices when creating an archive (default)

--no-check-device: Number is not checked by default

--checkpoint: Show process archive information per number of files (default is 10)

--checkpoint-action=action: Add action at every XX

--delay-directory-restore: Extract delay setting modify time and Permissions

--no-delay-directory-restore: Delete settings for--delay-directory-restore

--exclude=pattern: Exclude a file by a given wildcard character

--exclude-backups: Exclude files that update files and locks

--exclude-caches: Exclude content that contains Cachedir.tag

--exclude-caches-all: Exclude all folders that contain Cachedir.tag

--exclude-caches-under: Exclude all content that contains the Cachedir.tag folder

--exclude-tag=file: Exclude Eligible folders

--exclude-tag-all=file: Exclude all content under Eligible folders

--exclude-tag-under=file:

--exclude-vcs: Exclude system Version control

-F,--file ARCHIVE: Save archived files to ARCHIVE

-F,--info-script,--new-volume-script NAME: Executes the specified script after the archive finishes

--force-local:

--full-time: Print File detail time

-G,--listed-incremental FILE: Processing an incremental backup that complies with Gun-format

-G,--incremental: Processing a backup file that complies with Gun-format

--group=name: Specify the archive file as owner

-H,--dereference: Follow the symbolic link, they point out that the archive and dump files

-H,--format format:

Create an archive if the following conditions are met:

--format=gun

GUN tar 1.13.x format

--format=oldgnu
GNU format as per tar <= 1.12

--format=pax

POSIX 1003.1-2001 (PAX) format

          --format=posix

Same as Pax

--format=ustar
POSIX 1003.1-1988 (Ustar) format

--format=v7
Old V7 tar format

--hard-dereference

Follow hard links; archive and dump file references

-I.,--ignore-zeros

Ignore blocks of 0

-I.,--use-compress-program PROG

Filter prog, must be used in conjunction with-D

--ignore-case

Ignore case

--no-ignore-case

Sensitive pattern matching (default)

--ignore-command-error

Ignore exception exit

--no-ignore-command-error

Capturing an exit code other than 0

--ignore-failed-read

Do not exit when a file with no Read permission is encountered

--index-file=file

Mark a version of a file

-j,--BZIP2

-j,--XZ

-K,--keep-old-files

Don ' t replace existing files when extracting

      -K,--starting-file Member-name

Begin at Member Member-name in the archive

      --keep-newer-files

Don ' t replace existing files that is newer than their archive copies

      -L,--check-links

Print a message if not all links is dumped

      -L,--tape-length number

Change tape after writing number x 1024x768 bytes

--level=number
Dump level for created Listed-incremental archive

--lzip

--lzma

--lzop

-M,--touch

Don ' t extract file modified time

      -M,--multi-volume

Create/list/extract multi-volume Archive

      --mode=changes

Force (symbolic) mode changes for added files

--mtime=date-or-file
Set mtime for added files from date-or-file

-N,--seek

Archive is seekable

      -N,--newer,--after-date date-or-file

Only store files newer than Date-or-file

      --newer-mtime=date

Compare date and time when data changed only

--null
-T reads null-terminated names, disable-c

      --no-null

Disable the effect of the previous--null option

      --numeric-owner

Always use numbers for User/group names

      -O,--to-stdout

Extract files to standard output

      --occurrence

Process only the Numberth occurrence of each file in the archive;

      --old-archive,--portability

Same as--format=v7

      --one-file-system

Stay in the local file system when creating archive

--overwrite
Overwrite existing files when extracting

--overwrite-dir
Overwrite metadata of existing directories when extracting (default)

--no-overwrite-dir
Preserve metadata of existing directories

--owner=name
Force NAME as owner for added files

-P,--preserve-permissions,--same-permissions
Extract information about file permissions (default for Superuser)

-P,--absolute-names
Don ' t strip leading '/' s from file names

      --pax-option=keyword[[:]=value][,keyword[[:]=value]] ...

Control pax Keywords

--posix
Same as--format=posix

--preserve
Same as Both-p And-s

--quote-chars=string
Additionally quote characters from STRING

--no-quote-chars=string
Disable quoting for characters from STRING

      --quoting-style=style

Set name quoting style; See below for valid STYLE values

-R,--block-number
Show block number within archive with each message

--record-size=number
Number of bytes per record, multiple of 512

--recursion
Recurse into directories (default)

--no-recursion
Avoid descending automatically in directories

--recursive-unlink
Empty hierarchies prior to extracting directory

--remove-files
Remove files after adding them to the archive

--restrict
Disable use of some potentially harmful options

--rmt-command=command
Use given RMT COMMAND instead of RMT

--rsh-command=command
Use remote COMMAND instead of RSH

-S,--preserve-order,--same-order
Sort names to extract to match archive

-S,--sparse
Handle Sparse files Efficiently

--same-owner
Try extracting files with the same ownership as exists in the archive (default for Superuser)

--no-same-owner
Extract files as yourself (default for ordinary users)

--no-same-permissions
Apply the user ' s umask when extracting permissions from the archive (default for ordinary users)

--no-seek
Archive is not seekable

--show-defaults
Show tar defaults

--show-omitted-dirs
When listing or extracting, list all directory that does not match search criteria

--show-transformed-names,--show-stored-names
Show file or archive names after transformation

--sparse-version=major[. MINOR]
Set version of the sparse format to use (implies--sparse)

--strip-components=number
Strip number leading components from file names on extraction

--suffix=string
Backup before removal, override usual suffix (' ~ ' unless overridden by environment variable Simple_backup_suffix)

-T,--files-from FILE
Get names to extract or create from FILE

--to-command=command
Pipe extracted files to another program

--totals
Print Total bytes after processing the archive;

--transform,--xform EXPRESSION
Use sed replace EXPRESSION to transform file names

-U,--unlink-first
Remove each file prior to extracting over it

--unquote
unquote filenames read WITH-T (default)

--no-unquote

Do not unquote filenames read with-t

--utc
Print file modification times in UTC

-V,--verbose
verbosely List Files processed

-V,--label TEXT
Create archive with volume name TEXT; At list/extract time, use TEXT as a globbing pattern for volume name

--volno-file=file
Use/update the volume number in FILE

-W,--interactive,--confirmation


-W,--verify
Attempt to verify the archive after writing it

--warning=keyword
Warning control

--wildcards
Use wildcards (default for exclusion)

--wildcards-match-slash
Wildcards match '/' (Default for exclusion)

--no-wildcards-match-slash
Wildcards does not match '/'

--no-wildcards
Verbatim string Matching

-X,--exclude-from FILE
Exclude patterns listed in FILE

-Z,--gzip,--gunzip--ungzip

-Z,--compress,--uncompress

About the operating environment: tar behaves as if it is dependent on the operating environment, such as the configuration of the following environments

      

Simple_backup_suffix
Backup prefix to use when extracting, if--suffix are not specified. The backup suffix defaults to ' ~ ' if neither is
Specified.

Tar_options
Options to prepend to those specified on the command line, separated by whitespace. Embedded backslashes May used
To escape whitespace or backslashes within an option.

TAPE Device or file to use for the archive if--file are not specified. IF This environment variable are unset, use stdin or
StdOut instead.

tar_longlink_100

The tar feature is very powerful, so we can use it to understand these features, which is commonly used

-C: Create an archive
-X: Expand Archive
-T: Directly view archived files without expanding
-Z: Using gzip compression
-J: Using bz2 compression
-J: Using XZ compression

Small examples of use:

Tar-czf script.tar.gz Script

TAR-XF script.tar.gz

Linux Archive Tool---Tar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.