现在位置:首页 » linux技术部 » Linux 下压缩与解压.zip和.rar及.7z文件

Linux 下压缩与解压.zip和.rar及.7z文件

时间:2017-1-12 | 作者:楼台听枫雨 | 分类:linux技术部 | 评论(0) | 浏览(4393) | uedbet最新网站: linux .zip .7z .rar

对于Window下的常见压缩文件.zip和.rar,Linux也有相应的方法来解压它们:

1)对于.zip

linux下提供了zip和unzip程序,zip是压缩程序,unzip是解压程序。它们的参数选项很多,可用命令zip -help和unzip -help查看,这里只做简单介绍,举例说明一下其用法:

# zip yajiu.zip yajiu.jpg yajiu.png
这条命令是将yajiu.jpg和yajiu.png压缩成一个zip包
# zip yajiu.zip *.jpg
这条命令是将所有.jpg的文件压缩成一个zip包
# zip -r yajiu.zip yajiu
这条命令是将文件夹yajiu压缩成一个zip包
# unzip yajiu.zip
这条命令是将yajiu.zip中的所有文件解压出来

yajiu@yajiu-desktop:~$ cd 图片
yajiu@yajiu-desktop:~/图片zip yajiu.zip yajiu.jpg yajiu.png
updating: yajiu.jpg (deflated 34%)
updating: yajiu.png (deflated 0%)
yajiu@yajiu-desktop:~/图片$ zip yajiu.zip *.jpg
adding: 1.jpg (deflated 34%)
adding: 2.jpg (deflated 0%)
yajiu@yajiu-desktop:~/图片$ zip -r yajiu.zip yajiu
adding: yajiu/ (stored 0%)
adding: yajiu/yajiu.zip (stored 0%)
adding: yajiu/yajiu.jpg (deflated 34%)
adding: yajiu/yajiu.rar (deflated 0%)
adding: yajiu/yajiu.7z (deflated 0%)
adding: yajiu/yajiu.png (deflated 0%)
yajiu@yajiu-desktop:~/图片$ unzip yajiu.zip
Archive: yajiu.zip
replace 1.jpg? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: 1.jpg                   
replace 2.jpg? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
inflating: 2.jpg                   
yajiu@yajiu-desktop:~/图片$ 

原文链接:http://hi.baidu.com/zgyz/blog/item/f7ef29085c90d4d663d98665.html

2)对于.rar

安装: sudo apt-get install rar unrar

或者可从http://www.rarsoft.com/download.htm下载 RAR for Linux 编译安装
# tar -xzpvf rarlinux-3.8.0.tar.gz
# cd rar
# make
这样就安装好了,安装之后就有了rar和unrar这两个程序,rar是压缩程序,unrar是解压程序。它们的参数选项很多,可用命令rar -help和unrar -help查看,这里亦简单举例说明一下其用法:

# rar a yajiu.rar yajiu.jpg yajiu.png
这条命令是将yajiu.jpg和yajiu.png压缩成一个rar包
# rar a yajiu.rar *.jpg
这条命令是将所有.jpg的文件压缩成一个rar包
# rar a yajiu.rar yajiu
这条命令是将文件夹yajiu压缩成一个rar包
# unrar e yajiu.rar
这条命令是将yajiu.rar中的所有文件解压出来

yajiu@yajiu-desktop:~$ cd 图片
yajiu@yajiu-desktop:~/图片$ rar a yajiu.rar yajiu.jpg yajiu.png

RAR 3.80 beta 2   Copyright (c) 1993-2008 Alexander Roshal   16 Jun 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Creating archive yajiu.rar

Adding    yajiu.jpg                                                   OK 
Adding    yajiu.png                                                   OK 
Done
yajiu@yajiu-desktop:~/图片$ rar a yajiu.rar *.jpg

RAR 3.80 beta 2   Copyright (c) 1993-2008 Alexander Roshal   16 Jun 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Creating archive yajiu.rar

Adding    1.jpg                                                       OK 
Adding    2.jpg                                                       OK 
Done
yajiu@yajiu-desktop:~/图片$ rar a yajiu.rar yajiu

RAR 3.80 beta 2   Copyright (c) 1993-2008 Alexander Roshal   16 Jun 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Creating archive yajiu.rar

Adding    yajiu/yajiu.zip                                             OK 
Adding    yajiu/yajiu.jpg                                             OK 
Adding    yajiu/yajiu.rar                                             OK 
Adding    yajiu/yajiu.7z                                              OK 
Adding    yajiu/yajiu.png                                             OK 
Adding    yajiu                                                       OK 
Done
yajiu@yajiu-desktop:~/图片$ unrar e yajiu.rar

UNRAR 3.80 beta 2 freeware      Copyright (c) 1993-2008 Alexander Roshal


Extracting from yajiu.rar


1.jpg already exists. Overwrite it ?
[Y]es, [N]o, [A]ll, n[E]ver, [R]ename, [Q]uit Y

Extracting 1.jpg                                                     OK 

7a008fc287fe680c0ff477e9.jpg already exists. Overwrite it ?
[Y]es, [N]o, [A]ll, n[E]ver, [R]ename, [Q]uit Y

Extracting 2.jpg                                                     OK 
All OK
yajiu@yajiu-desktop:~/图片$ 

原文链接:http://hi.baidu.com/zgyz/blog/item/f7ef29085c90d4d663d98665.html

2)对于.7z

支持 7Z,ZIP,Zip64,CAB,RAR,ARJ,GZIP,BZIP2,TAR,CPIO,RPM,ISO,DEB 压缩文件格式

安装: sudo apt-get install p7zip p7zip-full p7zip-rar

# 7z a yajiu.7z yajiu.jpg yajiu.png
这条命令是将yajiu.jpg和yajiu.png压缩成一个7z包
# 7z a yajiu.7z *.jpg
这条命令是将所有.jpg的文件压缩成一个7z包
# 7z a yajiu.7z yajiu
这条命令是将文件夹yajiu压缩成一个7z包
# 7z e yajiu.7z
这条命令是将yajiu.7z中的所有文件解压出来,e是解压到当前路径
# 7z x yajiu.7z
这条命令是将yajiu.7z中的所有文件解压出来,x是解压到压缩包命名的目录下

yajiu@yajiu-desktop:~$ cd 图片
yajiu@yajiu-desktop:~/图片$ 7z a yajiu.7z yajiu.jpg yajiu.png

7-Zip (A) 4.58 beta Copyright (c) 1999-2008 Igor Pavlov 2008-05-05
p7zip Version 4.58 (locale=zh_CN.utf-8,Utf16=on,HugeFiles=on,2 CPUs)
Scanning

Creating archive yajiu.7z

Compressing yajiu.jpg      
Compressing yajiu.png      

Everything is Ok
yajiu@yajiu-desktop:~/图片$ 7z a yajiu.7z *.jpg

7-Zip (A) 4.58 beta Copyright (c) 1999-2008 Igor Pavlov 2008-05-05
p7zip Version 4.58 (locale=zh_CN.utf-8,Utf16=on,HugeFiles=on,2 CPUs)
Scanning

Creating archive yajiu.7z

Compressing 1.jpg      
Compressing 2.jpg      

Everything is Ok
yajiu@yajiu-desktop:~/图片$ 7z a yajiu.7z yajiu

7-Zip (A) 4.58 beta Copyright (c) 1999-2008 Igor Pavlov 2008-05-05
p7zip Version 4.58 (locale=zh_CN.utf-8,Utf16=on,HugeFiles=on,2 CPUs)
Scanning

Creating archive yajiu.7z

Compressing yajiu/yajiu.7z      
Compressing yajiu/yajiu.rar      
Compressing yajiu/yajiu.zip      
Compressing yajiu/yajiu.jpg      
Compressing yajiu/yajiu.png      

Everything is Ok
yajiu@yajiu-desktop:~/图片$ 7z x yajiu.7z

7-Zip 4.58 beta Copyright (c) 1999-2008 Igor Pavlov 2008-05-05
p7zip Version 4.58 (locale=zh_CN.utf-8,Utf16=on,HugeFiles=on,2 CPUs)

Processing archive: yajiu.7z

file 1.jpg
already exists. Overwrite with 
1.jpg?
(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename / (Q)uit? Y
Extracting 1.jpg
file 2.jpg
already exists. Overwrite with 
2.jpg?
(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename / (Q)uit? Y
Extracting 2.jpg

Everything is Ok

Files: 2
Size:       112564
Compressed: 96228
yajiu@yajiu-desktop:~/图片$
本文固定链接:http://www.fengtec.net/?post=43
本文由楼台听枫雨原创或编辑,互联分享,尊重版权,转载请以链接形式标明本文地址

发表评论:

  • 最新文章

  • Deepin Linux 检测串口并查看串口消息
  • U-NAS 下VirtualBox虚拟化-自启动服务
  • 有办法自动整合VMware快照?
  • Linux下使用vsftp搭建FTP服务器实现文件共享
  • 转vSphere Data Protection 6.1.2部署与配置
  • 分类

  • 文艺(2)
  • 生活(0)
  • 技术空间(0)
  • linux技术部(36)
  • windows技术部(7)
  • vmware虚拟化技术部(5)
  • uedbet最新网站

  • 人类的意识从何而来
  • VMware
  • linux
  • vpn
  • centos
  • 7
  • mysql
  • 安装
  • iptables
  • ntp
  • SERVER
  • 2003域控
  • 2012域控
  • 2008R2
  • DFS分布式文件系统
  • raspberry
  • pi
  • rasbian
  • raspberrypi
  • Raspbian
  • vsftp
  • centos7
  • 迅雷远程下载
  • NAS
  • 2008
  • 密码找回
  • oracle
  • 11g2
  • linx
  • RPM包依赖关系
  • apache
  • php
  • oracle11gR2安装
  • rpm安装
  • version
  • radius
  • 802.1X
  • ssh防暴力破解
  • 安全策略
  • LVM
  • Samba
  • NFS
  • raid
  • iscsi
  • tab补全
  • tab补全命令
  • tab命令补全
  • userhome
  • autofs
  • ipa-server
  • WIN2012激活
  • 源码安装软件
  • .zip
  • .7z
  • .rar
  • ubuntu
  • ufw
  • ibm_dsa_vmware_esxi日志
  • KMS服务器
  • enable
  • service
  • /usr/bin/perl:
  • office2013vol激活
  • semanage
  • selinux
  • vmtools
  • bad\interpreter
  • dns-server
  • bind-chroot
  • vcenter-client乱码改中文
  • VDP
  • ftp
  • linuxCOM
  • unas
  • virtualbox
  • 自动启动虚拟机
  • 口配置
  • Deepinlinuxcom口配置