In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how to use the Linux tar command, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
The Linux tar (English spelling: tape archive) command is used to back up files.
Tar is a tool used to create and restore backup files. It can join and unlock the files in the backup files.
Grammar
Tar [- ABcdgGhiklmMoOpPrRsStuUvwWxzZ] [- b] [- C] [- f] [- F]
Parameters:
-An or catenate add files to existing backup files.
-b or blocking-factor= sets the number of chunks per record, and each chunk size is 12Bytes.
-B or read-full-records resizes the chunk when reading the data.
-c or create creates a new backup file.
-C or directory= changes to the specified directory.
-d or diff or-compare compares the differences between files within the backup file and on the file system.
-f or file= specifies the backup file.
-g or listed-incremental handles a large number of backups in GNU format.
-G or incremental handles a large number of backups in the old GNU format.
-h or dereference does not establish a symbolic connection, but directly copies the original file that the connection points to.
-I or ignore-zeros ignores the 0 Byte block, or EOF, in the backup file.
When k or keep-old-files unlocks backup files, existing files are not overwritten.
-K or starting-file= starts the restore from the specified file.
The file system of the file or directory copied by l or one-file-system must be the same as the file system on which the tar instruction was executed, otherwise it will not be replicated.
-L or-tape-length= sets the capacity of each body, calculated in 1024 Bytes.
When-m or modification-time restores a file, the change time of the file is not changed.
-M or multi-volume uses multi-volume mode when creating, restoring, or listing backup files.
-N or newer= only saves files that are newer than the specified date to the backup file.
-o or old-archive or-portability uses the V7 format when writing data to a backup file.
-O or stdout outputs files restored from backup files to standard output devices.
-p or same-permissions restores the file with the original file permissions.
The-P or absolute-names file name uses an absolute name and does not remove the "/" sign before the file name.
-r or append adds a file to the end of an existing backup file.
-R or block-number lists the block number of each information in the backup file.
-s or same-order restores files in the same order as in backup files.
-S or-sparse save a file as a sparse file if it contains a large number of consecutive 0 bytes.
-t or-list lists the contents of the backup file.
-T or-files-from= specifies a template file that contains one or more template styles that allow tar to unravel or create files that meet the setting conditions.
-u or update replaces only files that are newer than those in the backup file.
-U or unlink-first disconnect the file before unlocking the compressed file to restore the file.
-v or verbose displays the instruction execution process.
-V or label= creates a backup file with the specified volume name.
-w or interactive ask the user first when there is a problem.
"after W or verify writes to the backup file, verify that the file is correct."
-x or extract or-get restore files from backup files.
-X or exclude-from= specifies a template file that contains one or more template styles and lets ar exclude files that meet the setting criteria.
-z or-gzip or-ungzip processes backup files through the gzip directive.
-Z or-compress or-uncompress processes backup files through the compress directive.
Set the number of the peripheral used for backup and the density of data stored.
After-date= this parameter has the same effect as specifying the "- N" parameter.
Atime-preserve does not change the access time of files.
Make a backup before backup= or-backup removes the file.
Checkpoint lists the directory name when it reads the backup file.
Concatenate this parameter has the same effect as specifying the "- A" parameter.
Confirmation this parameter has the same effect as specifying the "- w" parameter.
Delete deletes the specified file from the backup file.
Exclude= excludes files that match the template style.
Group= sets the group to which the files added to the device file belong to the specified group.
Help online help.
Ignore-failed-read ignores data reading errors and does not interrupt the execution of the program.
New-volume-script=
Newer-mtime saves only files that have been changed.
No-recursion does not do recursive processing, that is, all files and subdirectories under the specified directory are not processed.
Null reads the file name from the null device.
Numeric-owner replaces user name and group name with user identification code and group identification code.
Owner= sets the owner of the file added to the backup file to the specified user.
Posix uses the POSIX format when writing data to the backup file.
Preserve this parameter has the same effect as specifying the "- ps" parameter.
Preserve-order this parameter has the same effect as specifying the "- A" parameter.
Preserve-permissions this parameter has the same effect as specifying the "- p" parameter.
Record-size= this parameter has the same effect as specifying the "- b" parameter.
Before recursive-unlink unlocks the compressed file restore directory, unconnect all files in the entire directory.
After the remove-files file is added to the backup file, it is deleted.
Rsh-command= sets the instructions to be executed on the remote host in place of the rsh instruction.
Same-owner attempts to restore the file with the same file owner.
Suffix= backs up files before removing them.
After the totals backup file is established, list the file size.
Use-compress-program= processes backup files with specified instructions.
Version displays version information.
Volno-file= replaces the preset volume number with the number within the specified file.
Example
Compressed files are not packaged
# touch a.c # tar-czvf test.tar.gza.c / / compress A.C file to test.tar.gza.c
List the contents of the compressed file
# tar-tzvf test.tar.gz-rw-r--r-- root/root 0 2010-05-24 16:51:59 A.C
Extract the file
# tar-xzvf test.tar.gz a.c above is how to use the Linux tar command. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 272
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.