Linux中zip压缩和unzip解压缩命令详解

1、把/home目录下面的mydata目录压缩为mydata.zip
zip -r mydata.zip mydata #压缩mydata目录
2、把/home目录下面的mydata.zip解压到mydatabak目录里面
unzip mydata.zip -d mydatabak
3、把/home目录下面的abc文件夹和123.txt压缩成为abc123.zip
zip -r abc123.zip abc 123.txt
4、把/home目录下面的wwwroot.zip直接解压到/home目录里面
unzip wwwroot.zip
5、把/home目录下面的abc12.zip、abc23.zip、abc34.zip同时解压到/home目录里面
unzip abc\*.zip
6、查看把/home目录下面的wwwroot.zip里面的内容
unzip -v wwwroot.zip
7、验证/home目录下面的wwwroot.zip是否完整
unzip -t wwwroot.zip
8、把/home目录下面wwwroot.zip里面的所有文件解压到第一级目录
unzip -j wwwroot.zip

主要参数

-c:将解压缩的结果
-l:显示压缩文件内所包含的文件
-p:与-c参数类似,会将解压缩的结果显示到屏幕上,但不会执行任何的转换
-t:检查压缩文件是否正确
-u:与-f参数类似,但是除了更新现有的文件外,也会将压缩文件中的其它文件解压缩到目录中
-v:执行是时显示详细的信息
-z:仅显示压缩文件的备注文字
-a:对文本文件进行必要的字符转换
-b:不要对文本文件进行字符转换
-C:压缩文件中的文件名称区分大小写
-j:不处理压缩文件中原有的目录路径
-L:将压缩文件中的全部文件名改为小写
-M:将输出结果送到more程序处理
-n:解压缩时不要覆盖原有的文件
-o:不必先询问用户,unzip执行后覆盖原有文件
-P:使用zip的密码选项
-q:执行时不显示任何信息
-s:将文件名中的空白字符转换为底线字符
-V:保留VMS的文件版本信息
-X:解压缩时同时回存文件原来的UID/GID

通过 Composer 安装 Yii 2.0

一、在 Windows 中,你需要下载并运行 Composer-Setup.exe

二、安装composer后,更新镜像为国内镜像

C:\Users\Administrator>d:

D:\>cd wamp

D:\wamp>cd www

D:\wamp\www>composer config -g repo.packagist composer https://packagist.phpcomp
oser.com(更新镜像为国内)
You are running composer with xdebug enabled. This has a major impact on runtime
performance. See https://getcomposer.org/xdebug(提示php.ini中xdebug需关闭)

三、更新composer为最新版本

D:\wamp\www>composer self-update(更新为最新)
You are already using composer version 1.1.0 (stable channel).

四、开始安装yii

D:\wamp\www>composer global require “fxp/composer-asset-plugin:~1.1.0”
Changed current directory to C:/Users/Administrator/AppData/Roaming/Composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
– Installing fxp/composer-asset-plugin (v1.1.4)
Downloading: 100%

Writing lock file
Generating autoload files

五、创建项目

D:\wamp\www>composer create-project –prefer-dist yiisoft/yii2-app-basic basic
Installing yiisoft/yii2-app-basic (2.0.8)
– Installing yiisoft/yii2-app-basic (2.0.8)
Downloading: 100%

Created project in basic
Loading composer repositories with package information
Updating dependencies (including require-dev)
Reading bower.json of bower-asset/jquery (2.1.0)
Could not fetch https://api.github.com/repos/jquery/jquery-dist/contents/bower.j
son?ref=9434e03193c45d51bbd063a0edd1a07a6178d33f, please create a GitHub OAuth t
oken to go over the API rate limit
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+
on+7RBSGPCTR5ZQFHB+2016-05-13+0824
to retrieve a token. It will be stored in “C:/Users/Administrator/AppData/Roamin
g/Composer/auth.json” for future use by Composer.
Token (hidden):
Token stored successfully.
– Installing yiisoft/yii2-composer (2.0.4)
Downloading: 100%

– Installing swiftmailer/swiftmailer (v5.4.2)
Downloading: 100%

– Installing bower-asset/jquery (2.2.3)
Downloading: 100%

– Installing bower-asset/yii2-pjax (v2.0.6)
Downloading: 100%

– Installing bower-asset/punycode (v1.3.2)
Downloading: 100%

– Installing bower-asset/jquery.inputmask (3.2.7)
Downloading: 100%

– Installing cebe/markdown (1.1.0)
Downloading: 100%

– Installing ezyang/htmlpurifier (v4.7.0)
Downloading: 100%

– Installing yiisoft/yii2 (2.0.8)
Downloading: 100%

– Installing yiisoft/yii2-swiftmailer (2.0.5)
Downloading: 100%

– Installing yiisoft/yii2-codeception (2.0.5)
Downloading: 100%

– Installing bower-asset/bootstrap (v3.3.5)
Downloading: 100%

– Installing yiisoft/yii2-bootstrap (2.0.6)
Downloading: 100%

– Installing yiisoft/yii2-debug (2.0.6)
Downloading: 100%

– Installing bower-asset/typeahead.js (v0.11.1)
Downloading: 100%

– Installing phpspec/php-diff (v1.1.0)
Downloading: 100%

– Installing yiisoft/yii2-gii (2.0.5)
Downloading: 100%

– Installing fzaninotto/faker (v1.6.0)
Downloading: 100%

– Installing yiisoft/yii2-faker (2.0.3)
Downloading: 100%

Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod(‘runtime’, 0777)…done.
chmod(‘web/assets’, 0777)…done.
chmod(‘yii’, 0755)…done.

D:\wamp\www>