Tar is a linux system command, format: tar [main option + Secondary options] file or directory.
Tar command
1. The tar command is a reliable way to back up files in a unix/linux system and works in almost any environment, with permissions for all users.
2. Format tar [main option + Secondary options] file or directory
3. Main parameters
When using this command, the main option is required, and it tells Tar what to do, auxiliary options are auxiliary and can be used.
3.1 Main options:
-C Create a new profile. Select this option if the user wants to back up a directory or some files.
-R appends the file to be archived to the end of the archive file. For example, the user is ready to backup files, and found that there is a directory or some files forgot to back up, you can use this option to append the forgotten directories or files to the backup file.
-T lists the contents of the archive to see which files have been backed up.
-U update file. That is, replace the original backup file with the new file, if the file you want to update is not found in the backup file, append it to the end of the backup file.
-X releases the file from the archive file.
3.2 Auxiliary Options:
-B This option is set for the tape drive, followed by a number to indicate the size of the chunk, with a system preset value of 20x512 bytes.
-F using a profile or device, this option is usually required.
-K saves the file that already exists. For example, restoring a file, encountering the same file during the restore process, does not overwrite it.
-M when restoring files, set the modification time of all files to.
-M creates multiple volumes of files for storage on several disks.
-V Details the file information processed by tar. Without this option, TAR does not report file information.
-W each step requires confirmation.
-j represents the use of ' bzip2 ' program for file compression
-j represents a call to "XZ" program for file compression (but not in the RHEL5 1.53 above, can be used on the top of the RHEL6 2.23)
-Z Compress/unzip the file with gzip, plus this option to compress the archive file, but you must also use this option to decompress when restoring.
-A,--catenate,--concatenate
Merging an archive with an existing archive
-D,--diff,--compare
Compare the differences between the archive and the current file
--delete
Remove from archive
Other parameters
--atime-preserve
Do not change the access time of the dump file
-B,--block-size N
Specify a block size of Nx512 bytes (default n=20)
-B,--Read-full-blocks
Reassembly block on read (???!!!)
-C,--Directory DIR
Go to the specified directory
--checkpoint
Show directory name when reading archive
-F,--File [hostname:]f
Specify an archive or device (default is/dev/rmt0)
--force-local
Force local archive, even if a clone exists
-F,--info-script F--new-volume-script F
Use script F (implied-m) at the end of each disk
-G,--Incremental
Build a backup of the old GNU format
-G,--Listed-incremental F
Create a backup of the new GNU format
-H,--dereference
Does not dump dynamic links, dumps the files that the dynamic links point to.
-I.,--Ignore-zeros
Ignores 0-byte blocks in the archive (usually means end of file)
--ignore-failed-read
Make 0 mark in unreadable file before exiting???
-K,--Keep-old-files
Save an existing file, and do not overwrite it when expanded from the archive
-K,--Starting-file F
Start with the archive file F
-L,--One-file-system
Create an archive in the local file system
-L,--tape-length N
Pause after writing n*1024, wait for disk replacement
-M,--modification-time
When recovering files from an archive, do not use the new Time label
-M,--multi-volume
Create a multi-volume archive to store on several disks
-N,--after-date date,--Newer date
Only files with newer time are stored
-O,--old-archive,--portability
Archive in V7 format, without ANSI format
-O,--to-stdout
To expand a file to standard output
-P,--same-permissions,--preserve-permissions
Expand All Protection information
-P,--absolute-paths
Do not remove the '/' from the file name
--preserve
Like-p-S
Similar to-p-s
-R,--Record-number
Displays the number of records in the archive while displaying information
--remove-files
Delete a source file after you create an archive
-S,--same-order,--Preserve-order
???
--same-owner
Expand to make all files belong to the same owner
-S,--Sparse
Efficient processing
-T,--files-from F
Get the file name you want to expand or create from your files
--null
Read null-terminated file name, so-C fails
--totals
Displays the total number of bytes written with the--create parameter
-V,--verbose
Detailed display of processed files
-V,--label NAME
Assign a volume label to an archive
--version
Displays the version number of the TAR program
-W,--Interactive,--Confirmation
Each operation requires confirmation
-W,--Verify
Verify after writing to archive
--exclude FILE
Do not include the specified file
-X,--exclude-from FILE
Reads a list of files that you do not want to include from the specified file
-y,--bzip2,--bunzip2
Compress or decompress an archive with bzip2
-Z,--compress,--uncompress
Compress or decompress an archive with compress
-Z,--gzip,--ungzip
Compress or decompress an archive with gzip
--use-compress-program PROG
Compress or decompress the archive with PROG (PROG need to accept the-D parameter)
--block-compress
Archive by Block records for easy disk storage
-[0-7][LMH]
Specify drive and density [high school low]
For example:
2. Extract the files from the this.tar.gz in the current directory to the current directory we can use
Tar xzvf this.tar.gz./
The software that supports tar format under Windows has Winmount and so on.
Zip and unzip the tar command for Linux files