secce 发表于 2018-8-23 13:14:14

linux shell工具集合

  1)判断进程是否存在,如果不存在再执行启动命令,可以避免一个脚本同时启动多份
if [ $(ps -ef |grepbastion_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


页: [1]
查看完整版本: linux shell工具集合