shell实现数字打印从100到200的数 Linux

#!/bin/bash#name: print number from 100 to 200for i in $(seq 100 200)doecho $idone
标签: linux

发布于  2024-3-2 15:46

统计 cpu 内存 使用率的shell脚本代码 Linux

#!/bin/shclearwhile ((1>0))do NET=$(netstat -anp | grep 1000 | grep EST | wc -l) PRC=$(ps aux | grep thread1 | grep -v grep | grep -v SCREEN | awk '{ print " CPU: " $3 "%, MEM: " $4 "%, RSS: " $6/
标签: linux

发布于  2024-3-2 15:46

一个用了统计CPU 内存 硬盘 使用率的shell脚本 Linux

#!/bin/bash#This script is use for describle CPU Hard Memery Utilizationtotal=0idle=0system=0user=0nice=0mem=0vmexec=/usr/bin/vmstatwhich sar > /dev/null 2>&1if [ $? -ne 0 ]then ver=`vmstat -V
标签: linux

发布于  2024-3-2 15:46

shell 进度条实现代码 Linux

#!/bin/bashCOUNTER=0_R=0_C=`tput cols`_PROCEC=`tput cols`tput cup $_C $_Rprintf "["while [ $COUNTER -lt 100 ]do COUNTER=`expr $COUNTER + 1` sleep 0.1 printf "=>" _R=`expr $_R + 1` _C
标签: linux

发布于  2024-3-2 15:46

awk统计文件中某关键词出现次数的命令 Linux

awk -F "" '{for(i=1;i<=NF;++i) if($i=="a") ++sum}END{print sum}' test.c[root@xiaobb 5906]# awk '{for(i=1;i<=NF;++i) if($i=="test") ++sum}END{print sum}' test.c6[root@xiaobb 5906]# cat test.ctest
标签: linux

发布于  2024-3-2 15:46

shell查找当前目录下大于1M的文件的三种方法分享 Linux

1、使用find的参数实现 [root@xiaobb mnt]# find . -maxdepth 1 -size +1000000c./sys.tar.gz./install.tar.bz2./CTeX_2.9.0.152_Full.exe./php-5.3.6.tar.gz[root@xiaobb mnt]# ls -lhtotal 1.3G-rw-r--r--
标签: linux

发布于  2024-3-2 15:46

expect自动检测并重启另外一台服务器上的程序代码 Linux

[s005 you] # cat haproxy_expect #!/usr/bin/expectset ssh_user "fivetrees"set password "123456"spawn ssh -i /root/.ssh/$ssh_user Server004.xd.comexpect_before "no)?" {send "yesr" }sleep 0.5expect "Ente
标签: linux

发布于  2024-3-2 15:46

查看某时间段到现在的系统日志的sed命令 Linux

sed查看某时间段到现在的系统日志: sed -n '/May 20 17/,$p' /var/log/messages | less
标签: linux

发布于  2024-3-2 15:46

except自动登录的几段代码分享 Linux

#!/usr/bin/expect -fset timeout 30set host "192.168.1.198"spawn ssh $hostexpect_before "no)?" {send "yesr" }sleep 1expect "password:"send "123456r"expect "*#"send "echo my name is fivetrees > /roo
标签: linux

发布于  2024-3-2 15:46

bash批量修改文件名称的方法小结(增加,去除,修改后缀) Linux

一、加后缀1.问题:同以目录下有海量以日期命名的文件,其中有的有后缀,有的以点结尾,如20020101.,20020102.,……,20020101.td,20020102.td……要求:
标签: linux

发布于  2024-3-2 15:45