假定有一个名为test.txt的文件(后面的示例皆以该文件为例),内容如下: 1[root@root]# cat test.txt 2apple 3bit 4exe 5create 6delect 7exe 8flow 9good Linux shell获得字符串所在行数及位置 方式一:用 grep -n 1[root@root]# cat test.txt | grep -n exe 23:exe 36:exe 4 5[root@root]# cat test.txt | grep -n exe | awk -F ":" '{print $1}' 63 76 方式二:用 sed -n /查询的字符串/=...

查看 CPU 信息 查看cpu实时使用率 1[root@localhost ~]# mpstat 2Linux 3.10.0-1160.el7.x86_64 (localhost.localdomain) 2024年12月26日 _x86_64_ (32 CPU) 3 412时34分13秒 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 512时34分13秒 all 7.38 0.00 2.49 0.06 0.00 0.18 0.00 0.00 0.00 89.88 查看cpu在今天不同时间节点的使用率 1[root@localhost ~]#...