随笔分类 - LINUX_SHELL
摘要:# vim test2.txt Christian Scott lives here and will put on a Christmas party. There are around 30 to 35 people invited. They are: Tom Dan Rhonda Savag
阅读全文
摘要:测试文档: # cat test.txt This is line number 1. This is line number 2. This is line number 3. This is line number 4. sed s 替换文本命令: 将每一列中第2个 test 替换为 trial
阅读全文
摘要:常用 shell 命令: 0a、ls命令:查找文件。 # ls /etc/ 0b、grep命令:筛选结果。 # ls /etc/ | grep "passwd" 0c、awk命令:按列筛选。 # ls -l /etc/ | awk '{print $8}' 0d、sort命令:按列排序。 # ls
阅读全文
摘要:1、当硬盘空间不足15%时,循环删除最早的日志文件(ELK): #!/bin/bash for((i=20;i>=5;i-=1)) do code=`df /dev/mapper/ElkGroup-lv_elk | grep -c -E \(8[5-9]\%\)\|\(100\%\)` day=`d
阅读全文
摘要:最近一段时间服务器频繁遭到DDOS攻击,目前只能通过封IP来源来暂时解决。IP不源变化多端,光靠手工来添加简直是恶梦,想了个方法,用SHELL来做。 比较简单,但很实用:) 以下内容根据作者原文进行适当的修改:) 1.编写脚本 mkdir /root/bin vi /root/bin/dropip.
阅读全文
摘要:1.1、批量删除当前目录及子目录中指定类型的文件: [root@localhost logs]# find ./ -name *.bak | xargs rm -rf [root@localhost logs]# find ./ -name "*_2017-04-*.log" | xargs rm
阅读全文

浙公网安备 33010602011771号