天涯海角异孤星
zip 指令参数说明:
[root@VM_0_10_centos ~]# zip
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete OS files)
-r recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-@ read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-y store symbolic links as the link instead of the referenced file
-e encrypt -n don't compress these suffixes
-h2 show more help
打包某个目录下的所有文件和子目录时,可以用 -r 递归参数,要排除某个目录或文件可以用 -x 参数。但是要注意,-x 参数如果是排除目录,要用双引号包裹,末尾要加 * 号。
打包时排除某个文件:
zip -r yangdx.zip yangdx/ -x yangdx/test.txt
打包时排除 cache、vendor 目录:
zip -r yangdx.zip yangdx/ -x "yangdx/cache/*" -x "yangdx/vendor/*"
随机字符串常用于创建随机账号或密码,Linux 可用以下方法生成随机字符串。
1.生成由大写字母组成的随机字符串:
[root@VM_0_13_centos ~]# head /dev/urandom | tr -dc A-Z | head -c 20
NRXFYZRTUEDXTVPJAYJW
2.生成由小写字母组成的随机字符串:
[root@VM_0_13_centos ~]# head /dev/urandom | tr -dc a-z | head -c 20
rizsfwebsmfowsogsqfi
3.生成由纯数字组成的随机字符串:
[root@VM_0_13_centos ~]# head /dev/urandom | tr -dc 0-9 | head -c 20
06983118429648544871
4.生成由大写字母、小写字母、数字组成的随机字符串:
[root@VM_0_13_centos ~]# head /dev/urandom | tr -dc A-Za-z0-9 | head -c 30
kFac0BEcbWS9eTZWZwn52ps53kGp6q
5.写成 Shell 脚本:
#!/bin/bash
pass=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 30)
echo $pass
之前写了一篇163 邮箱的配置《CentOS mail配置163邮箱》,现在补充一下 qq 邮箱的配置。
1、获取qq邮箱授权码:...
2、在Linux系统上安装mailx服务:...
3、添加qq邮箱的smtp配置:...
4、下载qq邮箱的证书:...
对比下 fastcgi.conf 与 fastcgi_params 文件,可以看出只有以下差异,即 fastcgi.conf 只比 fastcgi_params 多了一行:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
原本只有 fastcgi_params 文件,fastcgi.conf是 nginx 0.8.30 才引入的。主要为是解决以下问题:原本 Nginx 只有 fastcgi_params,后来发现很多人在定义 SCRIPT_FILENAME 时使用了硬编码的方式。
例如:
fastcgi_param SCRIPT_FILENAME /var/www/foo$fastcgi_script_name;
于是为了规范用法便引入了 fastcgi.conf。
默认的官方 apt-get 源,在国内特别慢,执行 apt-get update
指令时几乎没反应,而替换为阿里云的 debian 源可以大大加快速度。
先备份 /etc/apt/sources.list ,然后替换 /etc/apt/sources.list 为下面的内容:
deb http://mirrors.aliyun.com/debian stable main contrib non-free
deb http://mirrors.aliyun.com/debian stable-proposed-updates main contrib non-free
deb http://mirrors.aliyun.com/debian stable-updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian stable main contrib non-free
deb-src http://mirrors.aliyun.com/debian stable-proposed-updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian stable-updates main contrib non-free