本节分享的这段shell脚本,实现对数字的递增排序。 代码: #!/bin/bash # 对数字进行递增排序 file= echo -n 输入文件名称 : read file if [ ! -f $file ] then echo $file 不是一个文件 exit 1 fi sort -n $file...
一段shell脚本,用于实现mysql的纯文本格式备份。 所谓的mysql纯文本格式数据,是在数据表中没有insert into这样的查询sql语句的存在,而只有类似如下: 123,xxx,xxx,xxx 123,xxx,xxx,xxx 123,xxx,xxx,xxx 123,xxx,xxx,xxx 的纯数据结构。 此种备份方式,可以...
写了一段shell脚本,用来清除c代码中的注释,不敢独享,分享给大伙。 运行示例:Run this script as follows: cat file.c | ./script.sh 1,c代码示例 file.c: #includestdio.h /* This is a test program * Version 1.0 * */ int main(){ printf(This is a...
分享一个可用于IPv6的iptables防火墙脚本,适用于 CentOS/Debian/RHEL/及其它 Linux 平台。 代码: #!/bin/bash # IPv6 iptables防火墙脚本 # -------- IPT6=/sbin/ip6tables # Interfaces PUB_IF=eth1 PUB_LO=lo0 PUB_VPN=eth0 # Custom chain names CHAINS...
shell结合iptables自动拒绝恶意连接ssh的方法及实现代码 本脚本实现: 1,增加自动释放被锁定的IP地址功能 2,增加自动执行时间,无需在任务计划中修改 3,不会频繁报警 调用方法: #nohup ./ssh 在后台不间断运行。 停止方法: #ps aux | grep ./ssh |grep -...
一个shell脚本,结合iptables实现防止ssh的暴力破解。 这段防止ssh暴力破解的脚本,不使用file2ban hostdeny pam_abl.so模块等软件,而是使用我们熟知的iptables。 代码: #!/bin/bsah # filename:ipt_ssh.sh # iptables防止ssh的暴力破解 # /sbin/iptables...
二个不错的iptables脚本,是学习iptables用法以及shell编程的好例子。 1,iptables脚本一 代码: #!/bin/sh # modprobe ipt_MASQUERADE modprobe ip_conntrack_ftp modprobe ip_nat_ftp iptables -F iptables -t nat -F iptables -X iptables -t nat -X #----...
一段不错的shell脚本,用于防止CC攻击,有用到的朋友,研究下吧。 代码: #!/bin/bash #script info: # Analysis access_log.abc log for a certain period of time to visit the suffix: mp3, # and more than a certain number of requests an IP address,...
如何用shell判断iptables服务是否开启呢? 问题:有如下的脚本,判断iptables是否开启,不知道是否正确? 代码: /sbin/service iptables status 1/dev/null 21 if [ $? -ne 0 ]; then _firewall_status=stopped fi 解答: 此脚本可以判断iptables服务是否开...
一个用于管理iptables的shell脚本,是学习iptables及shell编程的不错的例子。 注意: 由于启用了iptables防火墙,请注意下FTP的主被动模式。 FTP使用的是21端口,在进行FTP文件传输时,客户端首先连接到21端口,进行用户的认证,认证成功后,当要传输文件时,...
例子: 重启filebeat 升级版 #!/bin/bash ps -ef|grep filebeat |grep -v grep|cut -c...
crontab是linux自带的计划任务程序,可以实现分,时,日,周,月。 但是crontab有两个...
我在 CU 的日子并不长,有幸在 shell 版上与大家结缘。除了跟众前辈学习到不少技巧之...
cpu时间是一项重要的资源,有时,我们需要跟踪某个时间内占用cpu周期最多的进程。 在...
介绍一个强大的分析网络的shell脚本,此脚本是从EZHTTP拆分出来的,觉得有必要单独介...
Shell是一种具备特殊功能的程序,它是介于使用者和 UNIX/Linux 操作系统之核心程序(k...