赞
踩
查看切割 find ./ -name '*.mp4' | cut -d '/' -f3 | sort 按行合并文档 paste -s /mnt/json/*.json >> /mnt/a.json 查找并cp find ./ -type f -name '*.bmp' | grep -v ".*.src.*.bmp" | grep -v ".*.face.*.bmp" | xargs -i cp {} /mnt/pic2/ 杀死redis进程 #获取redis pid redis_pid=$(ps -ef | grep 6379 | grep -v grep | awk '{print $2}') #判断redis pid是不是存在 if [ ! $redis_pid ]; then echo 'redis pid does not exist.' else echo 'redis pid exists.' kill -9 $redis_pid fi # 打印redis pid ps -ef | grep 6379 | grep -v grep | awk '{print $2}' 脚本所在路径 SHELL_PATH=$(cd $(dirname $0);pwd) cd $SHELL_PATH/.. # shell脚本,根据字符串查找所有进程对应的目录 #!/bin/bash # 通过字符串查找所有进程 processes=$(ps aux | grep $1 | grep -v grep | awk '{print $2}') # 遍历进程并输出它们的目录 for process in $processes; do # 获取进程的工作目录 cwd=$(readlink /proc/$process/cwd) echo "Process $process is running in $cwd" done kill $(ps aux | grep "your_string" | grep -v grep | awk '{print $2}') 或 #!/bin/bash # 通过字符串查找所有进程 processes=$(ps aux | grep $1 | grep -v grep | awk '{print $2}') # 遍历进程并杀死它们 for process in $processes; do echo "Killing process $process" kill -9 $process done shell脚本,根据字符串查找所有进程并杀死, 一行 kill $(ps aux | grep "your_string" | grep -v grep | awk '{print $2}')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。