linux上俺们需要发送或则使用不少工具包都是压缩包,俺们就需要对该文件进行压缩或则解压linux打压缩包命令linux端口映射,但是linux不想windows那样用滑鼠点点点就行了linux打压缩包命令,linux上俺们必须使用命令来完成这项工做。linux

1.打包文件

tar-cvf打包后的文件名被打包文件

看板栗:web

linux打压缩包zip_linux命令行压缩文件_linux打压缩包命令

[root@localhost code]# ls
shell
[root@localhost code]# tar -cvf shell.tar shell
shell/
[root@localhost code]# ls
shell  shell.tar

2.对打包文件进行压缩

linux打压缩包命令_linux打压缩包zip_linux命令行压缩文件

tar-czvf压缩后文件名被压缩文件shell

shell  shell.tar
[root@localhost code]# tar -czvf shell.tar.gz shell.tar
shell.tar
[root@localhost code]# ls
shell  shell.tar  shell.tar.gz

这样就压缩完毕

现在俺们才能删掉包文件和源文件再去解压压缩包windows

linux命令行压缩文件_linux打压缩包命令_linux打压缩包zip

[root@localhost code]# ls
fq  shell  shell.tar.gz  sher  zlb
[root@localhost code]# rm -rf shell
[root@localhost code]# ls
fq  shell.tar.gz  sher  zlb
[root@localhost code]# tar -xzvf shell.tar.gz 
shell/
shell/sher
[root@localhost code]# ls
fq  shell  shell.tar.gz  sher  zlb

打包——压缩——解压——解包全过程ruby

linux打压缩包命令_linux命令行压缩文件_linux打压缩包zip

[root@localhost code]# ls
shell
[root@localhost code]# tar -cvf shell.tar shell
shell/
shell/sher
[root@localhost code]# ls
shell  shell.tar
[root@localhost code]# rm shell -rf
[root@localhost code]# ls
shell.tar
[root@localhost code]# tar -czvf shell.tar.gz shell.tar 
shell.tar
[root@localhost code]# ls
shell.tar  shell.tar.gz
[root@localhost code]# rm -rf shell.tar
[root@localhost code]# ls
shell.tar.gz
[root@localhost code]# tar -xzvf shell.tar.gz 
shell.tar
[root@localhost code]# ls
shell.tar  shell.tar.gz
[root@localhost code]# rm -rf shell.tar.gz 
[root@localhost code]# ls
shell.tar
[root@localhost code]# tar -xvf shell.tar 
shell/
shell/sher
[root@localhost code]# ls
shell  shell.tar
[root@localhost code]# rm shell.tar 
rm: remove regular file `shell.tar'? y [root@localhost code]# ls shell [root@localhost code]# 

压缩——解压简化过程svg

[root@localhost code]# ls
shell
[root@localhost code]# tar -czvf shell.tar.gz shell
shell/
shell/sher
[root@localhost code]# ls
shell  shell.tar.gz
[root@localhost code]# rm -rf shell
[root@localhost code]# ls
shell.tar.gz
[root@localhost code]# tar -xzvf shell.tar.gz 
shell/
shell/sher
[root@localhost code]# ls
shell  shell.tar.gz
[root@localhost code]# rm -rf shell.tar.gz 
[root@localhost code]# ls
shell
[root@localhost code]# cd shell/
[root@localhost shell]# ls
sher

解压和压缩是常常使用命令LINUX虚机,必将要把握工具

Tagged:
Author

这篇优质的内容由TA贡献而来

刘遄

《Linux就该这么学》书籍作者,RHCA认证架构师,教育学(计算机专业硕士)。

发表回复