linux 常用命令
作者:互联网
磁盘与目录:df 、ls、cd、pwd、mkdir
文件: vim、sed、chmod、chown、find、 cat、more、less、grep、touch、rm、mv、head、tail、cat
进程:top(实时)、ps -ef(快照)
网络:netstat -tlnp
数据操作:wc(统计)sort(排序)uniq(前后去重)
时间:
date+%Y/%m%d——2010/08/17
date+%H:%M——14:07
#! /usr/bin/sh
#监控间隔时间
interval=$1
#监控总次数
sum=$2
变量:
echo $PATH ${PATH}
查看环境变量:
env export
随机数:
RANDOM介于0-32767之间,0-9之间随机数:declare -i number=$RANDOM*10/32768;echo $number
#取时间
nmon_time=`date +%Y%m%d%H%M%S`
sleep 5
循环:
s=0
for ((i=1;i<=$nu;i=i+1))
s=$(($s+$i))
do
done
追踪和调试
sh -n cpu.sh
sh -x cpu.sh
while(($count<=sum))
do
item_time=`date +%Y%m%d%H%M%S`
echo "********************第{$count}次监控收集
********************"
echo ${item_time}>>/home/trace/hx/Vmstat
${nmon_time}.log
vmstat >>/home/trace/hx/Vmstat${nmon_time}.log
参数传递
sum=$1
时间
nmon_time=`date +%Y%m%d%H%M%S`
nmon_date=`date +%Y%m%d`
sleep 5
count=1
while(($count<=sum))
do
done
sum=5
count=1
while(($count<=sum))
do
netstat -aonp | grep -i ComS4Chl | grep -v LISTEN >> abc
date >> abc
sleep 1
count=`expr $count + 1`
done
#!/bin/bash
dbname=$1
monday=`date '+%y%m%d'`
mkdir -p ./ibmdbmon/$monday
db2 connect to $dbname
db2 update monitor switches using bufferpool on lock on sort on statement on table on uow
on timestamp on
db2 reset monitor all
sleep 1
montime=`date '+%H%M%S
echo "snapshot for database manager command completed successfully!
#结束语句
sleep $interval
count=`expr $count + 1`
done
标签:count,m%,nmon,+%,常用命令,sleep,linux,date 来源: https://www.cnblogs.com/hua13/p/15148111.html