问轩博客

展开菜单

Linux过滤空行

Linux过滤空行
grep -v "^$" file.txt sed '/^$/d' file.txt awk '!/^$/' file.txt egrep "\S" file.txt注:^$表示空行。grep -v 表示排除。sed '//d' 表示删除awk '!//' 表示排除或取反。...

如何正确清理MySQL binlog?

如何正确清理MySQL binlog?
1、MySQL命令行删除: 从第一个文件删除到第四个 mysql> purge binarylogs to 'mysql-bin.000004'; 按照时间,删除指定时间之前的 mysql> PURGE MASTER LOGS BEFORE '2017-03-20 00:00:00';  清除所有bin-log...

nginx禁止指定目录运行php

nginx禁止指定目录运行php
nginx禁止指定目录运行php,只需要在server配置段中增加个location规则就可以了。 1、禁止某一个目录执行php location ~* ^/download/.*\.(php|php5)$ { deny all; } 2、禁止多个目录执行php location ~* ^/(download|down)/.*\.(php|php5)$ { deny all; } 注意:...

Nginx屏蔽百度谷歌等搜索引擎蜘蛛方法

Nginx屏蔽百度谷歌等搜索引擎蜘蛛方法
‍‍‍‍在nginx的server字段中配置下面内容即可if ($http_user_agent ~* (baiduspider|googlebot|bing|sogou|yahoo)){return 503;}如果单独屏蔽百度蜘蛛就是if ($http_user_agent ~* baiduspider){return 503;}‍‍‍‍...

查看linux服务器cpu和内存信息

查看linux服务器cpu和内存信息
physical id 从0到1,说明有2个物理cpu; processor  从0到7,说明有8个逻辑CPU(如果不支持超线程的话); 支不支持超线程,就看siblings和cpu cores是否相等,如果siblings=cpu cores,则不支持超线程;如果siblings > cpu cores,则支持超线程,此时 逻辑cpu个数 = (...

使用sendEmail发送邮件

使用sendEmail发送邮件
下载:sendEmail-v1.56.tar.gz安装方式简单,不需要编译,只需把可执行文件添加到环境变量$PATH目录直接使用即可,由于该软件使用Perl开发,所以需要安装Perl。 使用方法: Synopsis:  sendEmail -f ADDRESS [options]   Required:     -f ADDRESS&nb...

Centos使用mailx465端口发送邮件

Centos使用mailx465端口发送邮件
1、关闭其它的邮件工具 service sendmail stop chkconfig sendmail off service postfix stop chkconfig postfix off 2、安装mailx yum install mailx 3、首先在QQ邮箱帐户-设置中开启smtp,开启后会得到一个授权码,这个授权码就代替了密码(自行去QQ...