With the development of Linux open source system platform, more and more open source software can provide to linuxhttp://www.aliyun.com/zixun/aggregation/6579.html "" > users, so that more files "swallowed" Hard disk space. As an excellent open source operating system, how to efficiently manage the software in the system is a very important problem. Therefore, Linux provides a variety of methods, users can easily manage the software according to the actual situation. For example, it provides a package of files that users can use to make several files or directories into a package, and it also provides a variety of file compression tools that allow users to compress certain files to reduce the amount of hard disk space that a file occupies or facilitate network transmission.
Tar Pack Management
The tar command is the most commonly used file packaging tool under Linux, which can be packaged into a file in a number of directories, both for file management and for easy compression and network transmission of files. Tar can create archives for files and directories. With tar, users can create files for a particular file (backup files), change files in files, or add new files to files
Tar command syntax and parameter options
The TAR command uses the following syntax: tar [main option + optional] file or directory where the main option is required to indicate the operation that the TAR command is to complete, auxiliary options are available or not. The following is a list of commonly used main options and a brief description of their functionality:-a 、--catenate 、--concatenate represents the merging of several tar files into a single tar file;-C 、--Create indicates the creation of a new tar file;-D 、--diff 、-- Compare represents the difference between the tar file or file system;--delete indicates that the file was deleted from the tar file, but the tape file could not be deleted;-R 、--Append to append the file at the end of the tar file;-T 、--list to display the contents of the tar file; 、--update indicates that you want to update the tar file;-X 、--extract,--get indicates that the file was removed from the tar file. Each time you use the tar command, the 8 command parameter options must be selected to indicate the type of operation.
Create tar File
Create a tar file to use the main parameter option C and to indicate the file name in which the tar file was created. The following assumes that the current directory has smart and xplns two subdirectories as well as Cpuinfo.txt, Smart.txt, Tar.txt, Tar_ Create.txt four files, the smart directory has smartsuite-2.1-2.i386.rpm files, Xplns directory has xplns-cat-3.3.1-1.i386.rpm,xplns-elm-3.3.1-1.i386.rpm and xplns-img-3.3.1- 1.i386.rpm three files. To package all files into Gong.tar files in this directory, you can use the following command: # tar CVF gong.tar./*. Where parameter C indicates the creation of tar, parameter F indicates the creation of the file, and parameter v indicates the detailed process of the display process.
Show tar file contents
For an existing tar file, the user might want to know what files and directories were packaged with the tar command with the T parameter. For example, for the resulting Gong.tar file, if you want to display its file content, you can use the following command: # tar TF gong.tar.
To remove a file from a tar file
Unpack in an existing tar file can be implemented using the TAR command with the main option parameter-X. The following is an example of the Gong.tar file, which describes the use of the TAR command with the main option parameter-X. Unpack the Gong.tar files in the current directory: #tar-x Gong.tar.
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.