您的位置:首页 > 运维架构 > Shell

linux shell工具集合

2016-01-10 00:00 513 查看
1)判断进程是否存在,如果不存在再执行启动命令,可以避免一个脚本同时启动多份

if [ $(ps -ef |grep  bastion_account.sh|grep -v grep|wc -l) -eq 0 ];then
nohup sh bastion_account.sh &
fi

2)如何批量kill进程?

ps -ef|grep 'python' |grep -v grep| awk '{print $2}’ | xargs kill -9

3)查看端口

netstat -lnpt 查看服务
ss -e 查看所有的连接数

4)查看服务器有没有来源某个ip的连接

netstat -anpl |grep '192.168.10.15'

5)分析 access log慢请求

cat access.log | awk ' $1>0.5 {print $1,$12}'

6)查看服务状态

service --status-all


原文地址:
linux shell工具集合

智能推荐

开启 NFS 文件系统提升 Vagrant 共享目录的性能

【改变mysql 日志位置Bug】Could not use mysql.log for logging (error 13)

最有用的Linux命令行使用技巧集锦

我的Mac软件集

IOS 移除storyboard
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: