vim 大小写转换
vim 大小写转换平时在写程序时经常会遇到大小写转换的问题,vim中提供了很多非常方便的大小写转换命令,可以快速的进行字母、单词、任意行的大小写转换,可以和vim的光标移动指令组合使用。
We have commands like "tr", tools like "sed", strong one liners from perl to do the conversions of lowercase UPPERCASE Titlecase . "vi" too provides the same, some of its :ex commands are below.
平时在写程序的过程中会经常遇到大小写转换的问题.我们有命令tr和工具sed,vi有类似的功能:
范例:
:1,$ s/.*/\L&/ #整个文件全部转换为小写
:1,$ s/.*/\U&/ #整个文件全部转换为大写
:1,$ s/\<./\u&/g #整个文件中每个单词的首字母大写
linux wget 详解
wget是linux上的命令行的下载工具。这是一个GPL许可证下的自由软件。wget支持HTTP和FTP协议,支持代理服务器和断点续传功能,能够自动递归远程主机的目录,找到合乎条件的文件并将其下载到本地硬盘上;如果必要,wget将恰当地转换页面中的超级连接以在本地生成可浏览的镜像。由于没有交互式界面,wget可在后台运行,截获并忽略HANGUP信号,因此在用户推出登录以后,仍可继续运行。通常,wget用于成批量地下载Internet网站上的文件,或制作远程网站的镜像shell 算术运算操作
算术运算符指的是可以在程序中实现加、减、乘、除等数学运算的运算符。Shell中常用的数学运算符如下所示。
+:对两个变量做加法。
-:对两个变量做减法。
*:对两个变量做乘法。
/:对两个变量做除法。
**:对两个变量做幂运算。
%:取模运算,第一个变量除以第二个变量求余数。
+=:加等于,在自身基础上加第二个变量。
-=:减等于,在第一个变量的基础上减去第二个变量。
*=:乘等于,在第一个变量的基础上乘以第二个变量。
/=:除等于,在第一个变量的基础上除以第二个变量。
%=:取模赋值,第一个变量对第二个变量取模运算,再赋值给第一个变量。
Linux下安装 Memcached服务器端
#!/bin/sh#Author : shiwei.du
#Date : 2016/04/08
#install libevent
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/
make && make install
cd ..
./configure: error: SSL modules require the OpenSSL library
make: *** No rule to make target `build', needed by `default'. Stop.
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl= option.
yum -y install openssl openssl-devel
标签: openssl openssl-devel
CentOS 7.0关闭默认防火墙启用iptables防火墙
操作系统环境:CentOS Linux release 7.0.1406(Core) 64位CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。
1、关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
2、iptables防火墙(这里iptables已经安装,下面进行配置)
vi/etc/sysconfig/iptables #编辑防火墙配置文件
# sampleconfiguration for iptables service
# you can edit thismanually or use system-config-firewall
# please do not askus to add additional ports/services to this default configuration
phpize Cannot find autoconf
Centos下执行phpize提示“Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this scrIPt.”原因:缺少autoconf
解决方法:
yum install autoconf
vim 删除指定的行
vim 删除指定的行
#-----命令行模式下------
1.删除以#开头的行:g/^#.*$/d
2.删除以//开头的行:
g/^\/\/.*$/d
3.删除空白行:
g/^$/d
4.刪除包含有空格組成的空行
g/^\s*$/d
5.删除以空格或tab開頭到結尾的空行
g/^[ |\t]*$/d
原创转载请注明来源:https://www.dushiwei.cn/post/461
shell脚本基本IF条件判断和判断条件总结
1、基本语法:if [ command ]; then
符合该条件执行的语句
fi
2、扩展语法:
if [ command ];then
符合该条件执行的语句
elif [ command ];then
符合该条件执行的语句
else
符合该条件执行的语句
fi
3、语法说明:
bash shell会按顺序执行if语句,如果command执行后且它的返回状态是0,则会执行符合该条件执行的语句,否则后面的命令不执行,跳到下一条命令。
当有多个嵌套时,只有第一个返回0退出状态的命令会导致符合该条件执行的语句部分被执行,如果所有的语句的执行状态都不为0,则执行else中语句。
返回状态:最后一个命令的退出状态,或者当没有条件是真的话为0。
linux find 统计目录下信息
linux find 目录统计下信息
linux 环境下通过find命令对目录下信息进行统计
1.统计/data/www-data目录下,php文件数量:find /data/www-data/ -name "*.php" |wc -l
2.统计demo目录下所有php文件代码行数:
find /data/www-data/ -name "*.php" |xargs cat|wc -l 或 wc -l `find ./ -name "*.php"`|tail -n1
3.统计/data/www-data/目录下所有php文件代码行数,过滤了空行:
find /data/www-data/ -name "*.php" |xargs cat|grep -v ^$|wc -l
转载标明来源!
热门日志
分类
- Django(4)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(32)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- about(1)
- git(9)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(2)
- 架构(19)
- Vue(1)
- game(2)
- Html(6)
- Java(8)
- Mysql(37)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(73)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Php(102)
- Windows(8)
- Message(48)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(12)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)
最新日志
- 成为架构师,如何真正具备“系统思维”?
- DHCP(Dynamic Host Configuration Protocol) 动态主机配置协议
- 从技术专家到战略领袖:成就技术总监的路径与思维
- python 如何读取超大的文件
- python requests 模块
- 如何给自己充电?
- 告别2024,迎接2025:深耕梦想,向前而行
- linux 的 dns 缓存,NSCD 服务
- The following untracked working tree files would be overwritten by checkout
- insecure connection not allowed,产生原因及如何解决