Detailed TAR command parameters

  

Description

The tar program is used to store or expand tar archive files. Archive files can be placed on disk or saved as regular files. Tar requires parameters. The optional parameters are A, c, d, r, t, u, x. You must first specify at least one parameter for tar when using tar; then, you must specify the file or directory to be processed. . If you specify a directory, all subdirectories under that directory will be added to the archive.

Application example:

1)Expand abc.tar.gz Use the command: tar xvzf abc.tar.gz Expand abc.tar Use the command: tar xvf abc.tar

2) Save the man directory and its subdirectories in the current directory as an archive. man.tar tar cf man.tar ./man

Parameter Description

The following parameters must be used when running tar At least one of them can run

-A, --catenate, --concatenate

merge an archive with an existing archive

-c, --create

Create a new archive

-d, --diff, --compare

Compare the difference between the archive and the current file

--delete

Remove from the archive

-r, --append

Append to the end of the archive

-t, --list

List the directories of files in the archive

-u, --update

Apply only newer files to the archive

-x, --extract, -- Get

Expanding files from archive

Other parameters

--atime-preserve

Do not change the access time of dump files

-b, --block-size N

Specified block size is Nx512 bytes (default is N=20)

-B, --read-full-blocks

When reading Block (???!!!)

-C, --directory DIR

Go to the specified directory

--checkpoint

Read Display directory name when archiving

-f, --file [HOSTNAME:]F

Specify archive or device (default is /dev/rmt0)

--force -local

Forcing the use of local archives, even if there are clones

-F, --info-script F --new-volume-script F

at the end of each disk Use the script F (implicit-M)

-G, --incremental

to create a backup of the old GNU format

-g, --listed-incremental F

Create a new GNU-formatted backup

-h, --dereference

Do not dump dynamic links, dump files pointed to by dynamic links.

-i, --ignore-zeros

Ignore 0-byte blocks in archives (usually means end of file)

--ignore-failed-read

Exit after marking 0 in an unreadable file? ? ?

-k, --keep-old-files

Save existing files; do not overwrite when expanded from archive

-K, --starting-file F

Starting from the archive file F

-l, --one-file-system

Creating an archive in the local file system

-L, - -tape-length N

Pause after writing N*1024 bytes, waiting to replace disk

-m, --modification-time

When from a file When restoring files, do not use the new time tag

-M, --multi-volume

Create a multi-volume archive to store on several disks

- N, --after-date DATE, --newer DATE

Store only newer files

-o, --old-archive, --portability

Archive in V7 format, no ANSI format

-O, --to-stdout

//This article comes from the computer software and hardware application network www.45it.com

Expand to standard output

-p, --same-permissions, --preserve-permissions

Expand all protection information

-P, --absolute-paths

Do not remove '/' from file name

--preserve

like -p -s

is similar to -p -s

-R, --record -number

Display the number of records in the archive at the same time when displaying the information

--remove-files

Delete the source file after creating the archive

-s, --same-order, --preserve-order

? ? ?

--same-owner

Make all files belong to the same owner after expansion

-S, --sparse

Efficient processing

-T, --files-from F

Get the file name to be expanded or to be created from the file

--null

Read the empty end file Name, invalidate -C

--totals

Display the total number of bytes written with the --create parameter

-v, --verbose

Detailed display of processed files

-V, --label NAME

Specifying volume labels for archives

--version

Displaying tar programs Version number

-w, --interactive, --confirmation

Every operation requires confirmation

-W, --verify

Write Check after archiving

--exclude FILE

Do not include the specified file

-X, --exclude-from FILE

Read the list of files that you do not want to include in the specified file

-y, --bzip2, --bunzip2

Use bzip2 to compress or decompress archives

-Z, - -compress, --uncompress

Compressing or decompressing archives with compress

-z, --gzip, --ungzip

Compressing or decompressing archives with gzip
>

--use-compress-pro Gram PROG

Compress or decompress archives with PROG (PROG needs to accept -d arguments)

--block-compress

For disk storage, block archives

-[0-7][lmh]

Specify the drive and density [high school, low]

--------------- -----------

Package: tar -cf soft.tar soft

Unpacking: tar -xf soft.tar soft

Compressing directory

Package compression: tar czvf usr.tar.gz /home

Unzip: tar xzvf usr.tar.gz

Compressed files (for directory invalidation)

Compression: zip good.zip good1 good2

Unzip: unzip good.zip

Copyright © Windows knowledge All Rights Reserved