search
HomeSystem TutorialLINUXCentos 7 compression and decompression command overview

1.zip file compression

Syntax: zip plus the compressed file name plus the file name to be compressed.

[root@localhost ~]# zip test.zip test.txt
  adding: test.txt (deflated 100%)
[root@localhost ~]# 
The percentage number of the progress bar appearing after

indicates that the compression has been completed. Then you can verify in ll to see if there is a file package you named.

[root@localhost ~]# ll
总用量 820004
-rw-------. 1 root root      1587 3月  22 16:58 anaconda-ks.cfg
-rw-r--r--. 1 root root      1635 3月  22 17:00 initial-setup-ks.cfg
-rw-r--r--. 1 root root 838860800 3月  26 14:56 test.txt
-rw-r--r--. 1 root root    814270 3月  26 14:57 test.zip
[root@localhost ~]# 

2. Unzip the zip file

To decompress

zip, add un in front of zip. If you want to specify the path, add -d

The syntax is unzip The file name to be decompressed -d Specify the decompression path

[root@localhost ~]# unzip test.zip -d /tmp/
Archive:  test.zip
  inflating: /tmp/test.txt           
[root@localhost ~]# 

Isn’t it very simple? Then use ls and add the path you specified to verify whether there are files you decompressed. If there are, it means you are successful. Congratulations on successfully learning zip compression and zip decompression! ! ! Then we continue....

[root@localhost ~]# ls /tmp
test.txt
[root@localhost ~]# 

3.tar compression and decompression

tar parameters are

-c Create a compressed file

-x Unzip a compressed file

-t View the files in the tar compressed file

-z Use gzip compression

-j Use bzip2 compression

-v displays files* during compression (commonly used) but is not recommended for background execution

-f uses the file name, note: f must be followed immediately by the file name, and no parameters can be added

Notice:

tar creates a file command

Syntax: tar [parameter] files and directories... ...

[root@localhost ~]# tar -czvf user /etc
tar: 从成员名中删除开头的“/”
/etc/
/etc/fstab
/etc/crypttab
/etc/mtab
/etc/resolv.conf
/etc/fonts/
/etc/fonts/conf.d/
/etc/fonts/conf.d/57-dejavu-serif.conf
/etc/fonts/conf.d/65-1-vlgothic-gothic.conf
/etc/fonts/conf.d/31-cantarell.conf
/etc/fonts/conf.d/65-0-lohit-nepali.conf
/etc/fonts/conf.d/59-liberation-mono.conf

There are a lot of things at the back that I can’t understand, so I went to the back and checked with ls to see if they exist.

[root@localhost ~]# ls
anaconda-ks.cfg  initial-setup-ks.cfg  test.txt  test.zip  user
[root@localhost ~]# 

Then let’s talk about decompression...

4. tar decompression

tar Add parameters and file name

[root@localhost ~]# tar -xvf user
etc/
etc/fstab
etc/crypttab
etc/mtab
etc/resolv.conf
etc/fonts/
etc/fonts/conf.d/
etc/fonts/conf.d/57-dejavu-serif.conf

There are a lot of decompression processes later, so I will omit them. Anyway, the decompression is successful

The following are the additions from other netizens

1. Linux version

Centos 7 压缩与解压缩命令小结

2. Unzip the .tar.gz package to the current directory

tar -xzvf apache-tomcat-7.0.90.tar.gz

Centos 7 压缩与解压缩命令小结
Centos 7 压缩与解压缩命令小结

3. Compress the specified file into a .tar.gz package

tar -czf apache-tomcat-7.0.90.tar.gz ./bin/ ./conf/ ./BUILDING.txt ./README.md

Centos 7 压缩与解压缩命令小结

4. Unzip the .war package to the current directory

jar -xvf file.war

Centos 7 压缩与解压缩命令小结
Centos 7 压缩与解压缩命令小结

5. Compress all files in the current directory into a .war package

jar -cvfM0 file2.war ./

Centos 7 压缩与解压缩命令小结
Centos 7 压缩与解压缩命令小结

6. Unzip the .tar package to the current directory

tar -xvf desk.tar

7. Compress the specified file into a .tar package

tar -czf desk2.tar ./file.pdf ./abc/

The above is the detailed content of Centos 7 compression and decompression command overview. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:脚本之家. If there is any infringement, please contact admin@php.cn delete
如何在 Windows 11 上启用或禁用内存压缩功能如何在 Windows 11 上启用或禁用内存压缩功能Sep 19, 2023 pm 11:33 PM

使用Windows11上的内存压缩,即使RAM量有限,您的设备也会窒息运行。在本文中,我们将向您展示如何在Windows11上启用或禁用内存压缩。什么是内存压缩?内存压缩是一种在将数据写入RAM之前压缩数据的功能,从而在其上提供更多存储空间。当然,存储在物理内存中的更多数据转化为更快的系统运行和更好的整体性能。此功能在Windows11中默认启用,但如果它以某种方式未处于活动状态,您可以禁用或重新启用它。如何在Windows11中启用内存压缩?单击搜索栏,键入powershell,然后从结果中单

pr文件的压缩类型不受支持怎么办pr文件的压缩类型不受支持怎么办Mar 23, 2023 pm 03:12 PM

pr文件的压缩类型不受支持的原因及解决办法:1、精简版pr把许多视频编码器精简掉了,重新安装使用完整版Premiere;2、视频编码不规范导致的,可以通过格式工厂,将视频转换成WMV格式即可。

如何使用Nginx进行HTTP请求的压缩和解压缩如何使用Nginx进行HTTP请求的压缩和解压缩Aug 02, 2023 am 10:09 AM

如何使用Nginx进行HTTP请求的压缩和解压缩Nginx是一款高性能的Web服务器和反向代理服务器,其功能强大且灵活。在处理HTTP请求时,可以使用Nginx提供的gzip和gunzip模块对请求进行压缩和解压缩,以减小数据传输量,提高请求响应速度。本文将介绍如何使用Nginx进行HTTP请求的压缩和解压缩的具体步骤,并提供相应的代码示例。配置gzip模块

linux怎么显示压缩文件信息linux怎么显示压缩文件信息Feb 13, 2023 am 10:20 AM

显示方法:1、用Vim编辑器,语法“vim 压缩文件”;2、用“tar -tf 压缩文件”命令;3、用“rar v 压缩文件”命令;4、用“unrar l 压缩文件”命令;5、用“zip -sf 压缩文件”命令;6、用“unzip -l 压缩文件”命令;7、用“zipinfo 压缩文件”命令;8、用“zcat 压缩文件”命令;9、用“zless 压缩文件”;10、用less。

Golang实现图片质量压缩的方法Golang实现图片质量压缩的方法Aug 17, 2023 pm 10:28 PM

Golang实现图片质量压缩的方法随着互联网的迅猛发展,图片已经成为了人们网上交流和信息传递的重要媒介之一。然而,高分辨率的图片不仅会占用大量的存储空间,而且在网络传输时也会增加加载的时间,给用户体验带来一定的影响。因此,在实际应用中,对图片进行压缩是一项非常有意义的工作。本文将介绍如何使用Golang实现对图片质量进行压缩的方法。首先,我们需要导入Gola

Linux服务器日志过大,如何解决?Linux服务器日志过大,如何解决?Jun 29, 2023 pm 11:09 PM

Linux服务器上常见的日志文件太大问题及其解决方法随着互联网的快速发展和服务器的广泛应用,服务器日志文件越来越大成为一个常见的问题。大量的日志数据不仅占用磁盘空间,还可能影响服务器的性能和运行稳定性。本文将讨论Linux服务器上常见的日志文件太大问题,并提供一些解决方法。一、常见的日志文件在Linux服务器上,常见的日志文件包括系统日志、应用程序日志、We

如何使用Java中的Zip函数进行文件压缩如何使用Java中的Zip函数进行文件压缩Jun 26, 2023 pm 02:10 PM

压缩文件是一种常见的操作,能够节省磁盘的空间以及网络传输的时间,而Java中提供了Zip函数用于实现文件的压缩。本文将通过详细的介绍和实例演示来展示如何使用Java中的Zip函数进行文件压缩。一、Zip函数介绍Zip函数是Java中提供的压缩和打包工具类库,使用该函数可以将文件或文件夹压缩成一个Zip格式的文件。Zip函数中主要使用了ZipOutputStr

rar是什么格式的文件rar是什么格式的文件Nov 24, 2022 am 10:53 AM

RAR是一种文件压缩与归档的私有文件格式,用于数据压缩与归档打包。RAR通常情况比ZIP压缩比高,但压缩/解压缩速度较慢;文件特点是:分卷压缩、固实压缩,在压缩包本身损坏但恢复记录够多时可对损坏压缩包进行恢复。

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

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.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool