惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
U
Unit 42
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
B
Blog RSS Feed
Vercel News
Vercel News
F
Fortinet All Blogs
Know Your Adversary
Know Your Adversary
T
Troy Hunt's Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
Jina AI
Jina AI
小众软件
小众软件
T
Threatpost
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
Scott Helme
Scott Helme
B
Blog
腾讯CDC
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
S
Schneier on Security
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
K
Kaspersky official blog
G
Google Developers Blog
T
Tor Project blog
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
Latest news
Latest news
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
罗磊的独立博客

博客园 - builderman

运行abp install-libs的时候,提示"NPM is not installed"的原因及解决办法 nginx 基本操作 nginx 正向代理与反正代理的区别及简单配置 KeyCloak基础概念 用crontab定时分隔nginx日志文件 修改linux终端中当前用户的显示颜色 minikube使用笔记 ssh端口转发 kubectl proxy 让外部网络访问K8S service的ClusterIP 记录一下我在ubuntu下安装 minikube的过程 ssh ssh-keygen 私钥 docker vscode server docker network docker mysql8 phpmyadmin Ubuntu添加开机自动启动程序的方法 Linux基本命令集合 linux下使用supervisor启动.net core mvc website的配置 小修改,让mvc的验证锦上添点花(2) 小修改,让mvc的验证锦上添点花(1)
linux 压缩与解压缩
builderman · 2018-12-17 · via 博客园 - builderman

常用的压缩类型有

.gz, .tar, .tar.gz, zip, .bz2, .tar.bz2

.gz(不保留源文件,不能压缩目录,压缩比不错)

gzip a.txt  #得到a.gz(不保留源文件)
gunzip a.gz  #得到a.txt(不保留源文件)

.tar(只打包,不压缩)

tar -cf a.tar a.txt #把a.txt打包成a.tar
tar -xf a.tar         #解压缩a.tar

.tar.gz (tar与gzip结合,只是在tar参数中增国了一个z)

tar -zcf a.tar.gz a.txt #把a.tzt打包成a.tar.gz
tar -zxf a.tar.gz         #解压缩a.tar.gz

 .zip(linux与window都可以兼容)

#压缩
[root@AY14 txt]# zip a.zip a.txt
  adding: a.txt (deflated 55%)

#解压缩
[root@AY14 txt]# unzip a.zip
Archive:  a.zip
replace a.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: a.txt

.bz2 (.gz的升级版本,加-k可以保留源文件)

#把a.txt压缩成a.txt.bz2,并且保留源文件
[root@AY14 txt]# bzip2 -k a.txt
[root@AY14 txt]# ls
a.txt  a.txt.bz2 

#解压a.txt.bz2,得到a.txt
[root@AY14 txt]# bunzip2 a.txt.bz2

 .tar.bz2 (tar与bz2结合)

#压缩文件加fFolder, 得到bFolder.tar.gz2
[root@AY14 txt]# tar -jcf bFolder.tar.bz2 bFolder
[root@AY14 txt]# ls
a.txt  bFolder  bFolder.tar.bz2


#解压
[root@AY14 txt]# tar -jxf bFolder.tar.bz2

注意:

生成.tar.gz与.tar.bz2时,用的命令都是tar 只是参数有一点点不一样

注意细节: 

c: 表示压缩(创建一个压缩文件)

x:表示解压

f:表示指定压缩包的文件名(好像f参数要放在最后一位)

z:表示用的是gzip

j:表示用的是bzip2

tar -zcf 压缩名的名字.tar.gz 源文件名
tar -jcf 压缩名的名字.tar.bz2 源文件名

tar -zxf 压缩名的名字.tar.gz
tar -jxf 压缩名的名字.tar.bz2