search
Homephp教程PHP开发Detailed explanation of tar decompression command

Compress the directory and its files today:
/usr/local/test

# tar -cvf /usr/local/auto_bak/test.tar /usr/local/test Only packaging, not compression
# tar -zcvf / After usr/local/auto_bak/test.tar.gz /usr/local/test is packaged, the name of the compressed file after the parameter f is compressed by gzip. It is customary to use tar to do it. If the z parameter is added, it is tar.gz or tgz represents a gzip-compressed tar file

Decompression operation:
#tar -zxvf /usr/local/test.tar.gz

tar Detailed explanation of decompression command

-c: Create a compressed archive

-x: Decompress
-t: View the content
-r: Append files to the end of the compressed archive file
-u: Update the files in the original compressed package

These five are independent commands and are used for both compression and decompression One of them can be used in conjunction with other commands but only one of them can be used. The following parameters are optional when compressing or decompressing archives as needed.

-z: With gzip attribute
-j: With bz2 attribute
-Z: With compress attribute
-v: Display all processes
-O: Unpack the file to standard output

The following parameter -f It is necessary

-f: Use the file name. Remember, this parameter is the last parameter, and can only be followed by the file name.

# tar -cf all.tar *.jpg
This command is to package all .jpg files into a package named all.tar. -c means generating a new package, and -f specifies the file name of the package.

# tar -rf all.tar *.gif
This command is to add all .gif files to the all.tar package. -r means adding files.

# tar -uf all.tar logo.gif
This command is to update the logo.gif file in the original tar package all.tar. -u means to update the file.

# tar -tf all.tar
This command is to list all the files in the all.tar package, -t means to list the files

# tar -xf all.tar
This command is to extract all. For all files in the tar package, -x means unzip

compression

tar –cvf jpg.tar *.jpg //Package all jpg files in the directory into tar.jpg

tar –czf jpg.tar.gz *.jpg //Package all jpg files in the directory into jpg.tar, and compress them with gzip to generate a gzip-compressed package named jpg.tar.gz

tar –cjf jpg.tar. bz2 *.jpg //Package all jpg files in the directory into jpg.tar, and compress them with bzip2 to generate a bzip2-compressed package named jpg.tar.bz2

tar –cZf jpg.tar. Z *.jpg //Package all jpg files in the directory into jpg.tar, and compress them with compress to generate a umcompress compressed package, named jpg.tar.Z

rar a jpg.rar *. jpg //For compression in rar format, you need to download rar for linux first

zip jpg.zip *.jpg //For compression in zip format, you need to download zip for linux first

Unzip

tar –xvf file.tar //Unzip tar package

tar -xzvf file.tar.gz //Extract tar.gz

tar -xjvf file.tar.bz2 //Extract tar.bz2

tar –xZvf file.tar.Z //Extract tar.Z

unrar e file.rar //Unzip rar

unzip file.zip //Unzip zip

Summary
(1), *.tar Use tar –xvf to decompress
(2), *.gz Use gzip -d or Gunzip decompress
(3), *.tar.gz and *.tgz use tar –xzf to decompress
(4), *.bz2 use bzip2 -d or bunzip2 to decompress
(5), *.tar.bz2 use tar – xjf Decompress
(6), *.Z use uncompress to decompress
(7), *.tar.Z use tar –xZf to decompress
(8), *.rar use unrar e to decompress
(9), *.zip use unzip Decompression



For more detailed explanations of tar decompression commands, please pay attention to the PHP Chinese website for related articles!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.