How to extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar files in Linux

不言
Release: 2019-03-13 10:41:29
Original
5072 people have browsed it

An archive file is a file consisting of one or more files in a compressed format. It is useful for saving disk storage. It is easier to manage a single file than multiple files. This article will help you decompress or extract archive files of Linux systems.

How to extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar files in Linux

How to extract a .zip file:

This is the most common one used by various IT professionals on many operating systems Compression format. To do this, we must unpack the binaries installed on the system.

$ unzip filename.zip
Copy after login

How to extract .gz files:

A gz file is a compressed file created using the gzip compression utility. Generally speaking, gzip is better than zip at compression, especially when compressing large amounts of files. .gz archive files can be extracted using the gunzip command.

$ gunzip filename.gz
Copy after login

How to extract a .tar file:

tar is a tape archive, also known as a tarball. This is another popular archiving method, also known as the Unified Unix Archive Format. To extract a .tar file, use the following command

$ tar -xvf filename.tar
Copy after login

How to extract a .tar.gz file:

A tar.gz file is a combination of tar and gzip files. If data is provided in more compressed formats. These files can be extracted using the -z switch.

$ tar -xzf filename.tar.gz
Copy after login

How to extract .tar.xz file:

The XZ format is a single file compression format and does not provide archiving functionality. It preserves the original data without any quality loss. These files can be extracted using -Jswitch.

$ tar -xJf filename.tar.xz
Copy after login

How to extract .tar.bz2 files:

tar.bz2 is a combination of tar and bzip2 archive formats. Archives can be filtered via bzip2 using -j. Use the following command to extract the .tar.bz2 compressed file.

$ tar -xjf filename.tar.bz2
Copy after login

The latest version of tar automatically detects the archive format. So you can simply use the following command.

$ tar -xf filename.tar.gz
Copy after login

How to extract .7z files:

These files are 7zip archive files. This is not typically used on Linux systems, but sometimes it may be necessary to extract some source files. The 7zip package must be installed on your system. Use the following command to extract these files.

$ 7z x filename.7z
Copy after login

How to extract .rar files:

These are common archive formats for Windows systems, but Linux users avoid these formats. However, there may be times when you need to extract .rar files on Linux. This can be extracted using the 7Z command or unrar.

$ 7z x filename.rar #使用7zip $ unrar x filename.rar #使用Unrar
Copy after login

This article has ended here. For more exciting content, you can pay attention to other related column tutorials on the php Chinese website! ! !

The above is the detailed content of How to extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar files in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!