乱七八糟

一、tab补全

linux系统如果使用最小化安装后,tab键默认是不能自动补全命令的,比如阿里云ecs
yum install bash-completion 之后重启系统即可

二、linux帮助命令tldr-->too long don't read,意思是太长不看,比系统自动的man命令要好用很多

安装
pip install tldr

使用
tldr 命令

三、配置阿里云yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

四、nginx地址重写

1.实现curl和火狐访问相同链接返回的页面不同
在配置文件中
if ($http_user_agent ~* firefox) {    //识别客户端firefox浏览器,$http_user_agent是nginx内置变量,~正则匹配,*是不区分大小写
rewrite ^(.*)$ /firefox/$1;           //$1变量是要访问的相同文件名的页面
}
2.地址重写格式【总结】
    rewrite 旧地址 新地址 [选项];
    last 不再读其他rewrite,也就是下面的rewrite语句不读了,匹配即停止,不读其他rewrite了
    break 不再读其他语句,结束请求   比last更强烈一些,下边location也不读了,立即结束所有请求
    redirect 临时重定向和permament 永久重定向,地址栏都会变,主要区别是在蜘蛛爬取时,临时重定向蜘蛛不会修改原来连接,永久重定向蜘蛛会
            修改新的连接地址,对于客户端是无感知的   

五、密钥对

1. ssh-key 之后一直回车可以创建rsa类型2048位的公钥和私钥对,但是这种需要交互的不适合用与写脚本
2. ssh-key -t rsa -b 2048 -N ''  执行这个命令就可以直接生成密钥对,免交互
    - -t 是密钥对算法类型
    - -b 是2048位
    - -N 是new_passphrase设置密钥的密码,''意思是密码为空-N          

六、用户下次登陆要求修改密码

chage -d 0 <user-name>  // -d 后边跟0表示下次用户登录强制修改密码

七、 json语法规则

- 数据在名称/值对中
- 数据由逗号分开
- 大括号保存对象
- 中括号保存数组
When nothing seems to help, I go look at a stonecutter hammering away at his rock, perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow it will split in two, and I know it was not that blow that did it, but all that had gone before. -- Jacob Riis
原文地址:https://www.cnblogs.com/xhwy-1234/p/12097684.html