Traditional Culture Encyclopedia - Traditional festivals - How does linux compress folders and how does linux compress files
How does linux compress folders and how does linux compress files
How does linux decompress zip files? Let's have a look.
1. Open the linux system and right-click on the blank space of the linux desktop.
2. In the pop-up drop-down option, click Open Terminal to enter the command line.
3. Enter the cdzip command in the terminal window to enter the zip directory.
4. Enter the ls command to confirm the full name of the zip file.
5. Enter the unzip command to unzip the zip package.
6. Inflating indicates successful decompression.
Tar command encyclopedia?
Tar command is a common decompression and compression command in Linux-like programs.
In fact, when using the tar command, the tar command itself uses the archive function, that is, the files are not really compressed and packaged, and the created archive files are often greater than the sum of all the original files, which is equivalent to putting some things into the storage box in daily life, and the weight of the whole storage box is greater than the total weight of the original items.
If you want to compress a file, you will usually call other commands to achieve it. There are three commonly used commands: zip, gzip2 and bzip, in which zip command is generally used alone, while gzip2 and bzip are generally used together with tar command.
For the specific usage of tar command, you can use mantar command to view the basic commands of tar. The following is an example of tar's basic command.
Some commonly used command parameters are as follows:
-c-create creates a new document.
-v-verbose displays the detailed file information of tar processing.
-f-file The file name to operate on.
-x-extract,-get the extracted file.
-z-gzip, -gunzip, -ungzip is compressed and archived by gzip.
-j-bzip2 archives compressed files through bzip2.
-t-list means viewing files and viewing file contents.
-c -C-directory=DIR Unzip the file to the specified directory.
-r-append means to add a file and append the file to be added to the end of the compressed file.
-u-update appends only newer files to the archive file.
-d-diff, -compare compares the differences between the archived file and the current file; -Delete Delete from the archive
-remove-files deletes the original file after compression.
-exclude Excludes directories or files that do not need to be compressed.
Specific usage:
-c-create creates a new document.
-v-verbose displays the detailed file information of tar processing.
-f-file The file name to operate on.
# tar-CVF sysconfig . tar/etc/sys config
Command explanation: package the files in the /etc/sysconfig/ directory into sysconfig.tar files and put them in the current directory.
(You can use the pwd command to view the current path, and you can use the ls command to view the current folder).
-r-append means to add a file and append the file to be added to the end of the compressed file.
# tar-rvfsysconfig . tar/etc/sys config/
Command explanation: Add the files in the /etc/sysconfig/ directory to the file sysconfig.tar file and put it at the end.
-t-list means viewing files and viewing file contents.
#tar-tfsysconfig.tar
Explanation of command: See which files are included in sysconfig.tar compressed files.
-remove-files deletes the original file after compression.
# tar-cvfsysconfig.tar1.txt2.txt3.txt-Delete-File
Command explanation: archive compressed 1.txt2.txt3.txt, and delete these three files after successful archiving.
-exclude Excludes directories or files that do not need to be compressed.
# tar-CVF sysconfig . tartest 1/*-exclude = test 1/log
Command explanation: compress all files and folders in the test 1 directory except the log directory.
Cannot add/after the log directory.
# tar-CVF sysconfig . tar 1 . txt 2 . txt 3 . txt-exclude = txt 4 . txt
Command explanation: archive compresses 1.txt2.txt3.txt, but excludes txt4.txt
-x-extract,-get the extracted file.
#tar-xvfsysconfig.tar
Command explanation: unzip the file sysconfig.tar and unzip the compressed file sysconfig.tar to the current folder.
-c -C-directory=DIR Unzip the file to the specified directory.
#tar-xvfsysconfig.tar-C/root
Command explanation: unzip the file sysconfig.tar and unzip the compressed file sysconfig.tar to the/root directory.
Tar calls the program to compress and decompress:
1, tar calls gzip.
A file ending with. Gz is a file compressed by calling the gzip program. On the contrary, one begins with. Gz needs to be decompressed with gunzip. Use the -z parameter in tar.
Call gzip program. Here's an example to illustrate.
-z-gzip, -gunzip, -ungzip is compressed and archived by gzip.
# tar-czvfsysconfig . tar . gz/etc/sys config/
Command explanation: package the directory /etc/sysconfig/ into a tar file package, and use the -z parameter to call the gzip program to compress the directory /etc/sysconfig/.
Compress into a sysconfig.tar.gz file and place the compressed file in the current folder.
-z calls gzip program to compress the file, and the compressed file name is named as. gz。
#tar-xzvfsysconfig.tar.gz
Command explanation: This command decompresses the previous command.
2.tar calls bzip2.
A file ending in .bz2 is a file compressed by calling the bzip2 program. On the contrary, files ending in .bz2 need to be decompressed using bunzip2. Use -j in tar.
Parameter to call the program bzip2.
-j-bzip2 archives compressed files through bzip2.
# tar-cjvfsysconfig . tar . bz2/etc/sys config/
Command explanation: package the /etc/sysconfig/ directory into a tar package, and then use the -j parameter to call the bzip2 compressed file, and do the following for the directory /etc/sysconfig/
Compress, compress into a file sysconfig.tar.bz2 and put it in the current directory.
#tar-xjvfsysconfig.tar.bz2
Command explanation: unzip the compressed package generated by the last command.
Zip for compression and decompression.
The file at the end. Zip calls the zip program to compress the file.
# zipsysconfig . zip/etc/sys config/
Command explanation: package the /etc/sysconfig/ directory into a zip package.
#zip-retc.zip/etc
Command explanation: package the entire directory of /etc into a zip package.
#unzipsysconfig.zip
Command explanation: unzip sysconfig.zip package.
How to decompress and compress tar.xz file under linux?
http://tukaani.org/xz/
Download an xz through yum or install an xz, and then unzip your file. Your papers. How does tar. xz Linux server decompress rar files?
This function is commonly used under linux.
How to extract RAR file (hmkart) under Linux needs to be downloaded from.
Download RARforLinux3.2.0 (you can also search RARforLinux online), decompress and make it.
Then you can use unrareyoufilename.rar to extract the rar file.
Specifically, after downloading rarforlinux, extract it to a directory, such as /usr/local/rar directory, and then execute the following command to extract it.
/usr/local/rar/rarxfilename, please refer to its help for other functions.
- Previous article:How to make the bottom material of shabu-shabu by yourself?
- Next article:What are the characteristics of Russian art?
- Related articles
- What is the Northeast Kiln?
- Miss the love of traditional music
- Where is the barber shop cheap in Lin 'an?
- The historical origin of ou plastic
- Why is there still a hierarchical concept that so many people carry around in Chinese society?
- European architectural style China architectural style characteristics
- How much does a grilled fish cost to make money? If I open a grilled fish shop, please advise me.
- What does antithesis mean in Chinese?
- Details of the sprayer
- The core of traditional art is