1. Function Description tar is an archiving tool that is often used under Linux. It is a file or directory that is packaged and archived into one file, but it is not compressed. The format is as follows: tar [main option + auxiliary options] file or directory tar command options are many, here are some of the main options that are often used, as shown in Table 4.31. Table 4.31 Main Options and Descriptions of the tar Command
Main Option Meaning -c Create a new file -r Append the file to be archived to the end of the archive file -t List the archived files in the archive file -x Restores a file from a packaged archive file -u Updates the archive file. The details of the original file accessibility options in the file are replaced with the new file as shown in Table 4.32. Table 4.32 Auxiliary Options and Descriptions of the tar Command
Auxiliary Options Meaning -z Invoke the gzip command to compress/decompress files during file packaging -w When restoring files, set the modification time of all files For the current time -j call the bzip2 command to compress/decompress the file during the file packaging process -Z call the compress command to filter the file -f “-f” option followed by the file storage device, the default is the disk, you need to specify the file File name; if it is a tape, just specify the tape device name. Note that you can't follow any other options after the "-f” option, that is, “-f” must be the last option of the tar command -v specifies the name of each archive file to be displayed during the creation of the archive file - p During the file archiving process, keep the properties of the file unchanged -N “yyyy/mm/dd” Files after the specified date will be packaged into the archive file --exclude file During the packaging process, will not Specify file file packaging 2. For example, (1) package all the files in the /etc directory, and display the packaged detailed files. Set the package file name to etc.tar and save the file to the /opt directory. [root@dbbackup oracle]#tar -cvf /opt/etc.tar /etc The file name here is "etc.tar"; the name is taken by ourselves, and the archive file packaged by tar command on Linux is generally used. Tar is used as the logo. (2) Package and compress all the files in the /etc directory, then display the packaged detailed file, set the package file name to etc.tar.gz, and save the file to the /opt directory. [root@dbbackup oracle]# tar -zcvf /opt/etc.tar.gz /etc[root@dbbackup oracle]#tar -jcvf /opt/etc.tar.bz2 /etc“zcvf”Options are called after the package is complete The gzip command compresses the archive file. The file name here is “etc.tar.gz”, which is also taken by us. “.tar” indicates that it is packaged with the tar command. “.gz” means that the gzip command is called. Compressed. Similarly, the “jcvf” option indicates that the bzip2 command is used to compress the archive file after the package is completed. The file naming identifier “<quo;.bz2” indicates that the bzip2 command was invoked for compression. There is no hard and fast rule for the name of the archive file. The naming rules used above can easily let us know the type of the file and the corresponding decompression method. Because the compression method is different, the decompression method is different. At the same time, this rule is also a hidden rule that everyone has acquiesced. If you don't like this rule, you can name the file as you like. (3) Check the contents of the /opt/etc.tar.gz archive above. [root@dbbackup oracle]#tar -ztvf /opt/etc.tar.gz[root@dbbackup oracle]#tar -jtvf /opt/etc.tar.gz
Note“etc.tar.gz&rdquo There may be many files, and one screen cannot be displayed. You can use the more command, for example, tar –zxvf /opt/etc.tar.gz
Many Linux enthusiasts consider the hardware configuration to be compatible with Linux systems when
Linux kernel is very stable, but it is still inevitable to encounter a crash, get the memory image w
The missing header file ‘security/pam_modules.h’ is part of the libpam development, a P
lftp is an ftp client under Linux for logging in to a remote FTP server. Use its mirror command to b
Linux obtains the native ip address method through Shell.
Several ways to load Windows partitions
Mandriva Linux Financial Crisis New investors reach out
Linux tar.gz, tar, zip, etc. decompress, compress the command
Linux loses Grub.conf file to start server
How to operate files under Linux
Linux System Tips: Two Ways to Add Soft Routes in Linux
Storage medium of memory in STM32 three boot modes
AMH VPS control panel always fails to log in. The password is not registered.
Collapsed: mobile phone fast typing tips
How to cleverly close the SkyDrive icon of Win8.1
How to recover the built-in application of Win10 uninstall?
How to add WD scan options to the Win10 file right-click menu
Win10 Preview 10547 Update Content Daquan
Win10 preview can not open the office uninstall reload can still not solve
Uninstall IE10 in Win8 to make other default browsers
How many do you know about the "sleeping method" of the Win7 system?
How to set up the cheetah browser compatibility mode Graphic tutorial