杂记

来源:互联网 发布:瑞典大学排名 知乎 编辑:程序博客网 时间:2024/04/29 21:04


1、利用awk判断不重复的元素列

awk -F'|' '{if(!x[$3]++) print $3}' 20141128_sgl.txt


2、删除指定程序的进程

ps -ef |grep WebService|grep -v grep |awk '{print $2}' | xargs kill -9


3、mount挂载NSF

mount -t cifs //192.168.1.8/DataProject /mnt/data -o username=guest,password=mycapital


4、删除指定目录下的带后缀的所有文件

find . -name '*.pyc' | xargs rm


5、查找指定文件夹下所有文件的某内容

find . -type f |xargs grep  'needworld'


6、mysql创建utf8编码的数据库

create database if not exists rss_debug default character set utf8 collate utf8_general_ci;


7、awk统计特定数据个数
awk -F'|' 'BEGIN{cnt=0} {if($5 > 0){cnt+=1}} END{print cnt}' 20141128_dep.txt


8、awk查找进程的pid

ipcs | awk '{if($2~/^[0-9]+$/) print $2}'


9、linux命令下转化时间戳

date -d "@1332700478"
date -d "2012-03-26 02:34:38" +%s


10、mysql授权外网访问

grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
flush privileges;

修改/etc/mysql/my.conf
找到bind-address = 127.0.0.1这一行
改为bind-address = 0.0.0.0即可



0 0
原创粉丝点击