shell

vim使用中文参考手册

 

1、杀死某关键词进程,启动服务进程为后台运行模式

count=`ps -ef |grep keywords |grep -v "grep" |wc -l`
echo $count
if [ 0 == $count ];then
echo 'no process'
else
ps -ef|grep keywords |grep -v grep|cut -c 9-15|xargs kill -9
fi

nohup ./keywords >/dev/null 2>&1 &

2、查询内存占用最高的4个进程

ps -aux |sort -rnk 4|head -n 5

3、linux下查看进程运行的时间

 ps -eo pid,tty,user,comm,lstart,etime | grep init

参数说明:

pid:进程ID

tty:终端

user:用户

comm:进程名

lstart:开始时间

etime:运行时间

 

4、查看文件夹下是否有大于1M的txt文件并排序输出

      下面脚本出处连接地址

#先通过查看是否有大于1M的txt文件,没有的话就不用继续了
find . -name '*.txt' -size +1M -type f 
#若有
find . -name '*.txt' -size +1M -type f -print0|xargs -0 du -m|sort -nr|head -10

 

#vim操作
全选(高亮显示):按esc后,然后ggvG或者ggVG
全部复制:按esc后,然后ggyG
全部删除:按esc后,然后dG

 

5、查找一个大文件中的某个限定字符

cat rules_domain.csv | grep "^t.cn" | more

  

telnet监控一个端口是否打开

https://blog.csdn.net/qq_43716912/article/details/113820248

 

 

  

  

  

posted @ 2019-08-23 13:42  zhucezmf  阅读(156)  评论(0编辑  收藏  举报