shell 1~3学习

SHELL1 统计文件的行数
SHELL2 打印文件的最后5行
SHELL3 监控CPU使用率
shell 1
#
!/bin/bash wc -l a.txt
shell 2
#!/bin/bash tail -n5 a.txt
shell 3
#
!/bin/bash cpUse=$(top -b -n 1 | grep Cpu | awk '{print $8}') echo "cpu use: $cpUse" ps -eo user,pid,pcpu,pmem,args --sort=-pcpu |head -n 4

 

 

posted @ 2023-01-26 21:31  13763857269  阅读(23)  评论(0)    收藏  举报