#1.如何获取进程app的pid
ps -ef | grep app | grep -v grep | awk '{print $2}'
#2.如何获取进程app的连续运行时间
ps -ef | grep app | grep -v grep | awk '{print $7}'
#3.top显示指定的进程
top -p pid | grep pid
#4.top输出指定进程信息到文件
if [ ! -f "app.log" ]; then
touch app.log
fi
top -p pid |grep pid >> app.log
#5.统计指定目录下的代码总行数
find . "(" -name "*.h" -or -name "*.cpp" -or -name "*.c" ")" -print | xargs wc -l
shell的一些常用命令组合
于 2020-08-04 14:36:16 首次发布