服务器命令

pids=`netstat -nlp | grep :5000 | awk '{print $7}' | awk -F"/" '{print $1}'`

>python app.py runserver 0.0.0.0:5000

>tmux a

> ps ux | grep app.py | grep -v grep | awk -F' ' '{print $2}'

>kill -9 22659 22661

>pids=`ps ux | grep app.py | grep -v grep | awk -F' ' '{print $2}'`
> for i in ${pids}; do     kill ${i}; done

pids=`ps -ef | grep python | awk -F' ' '{print $2}'`
for i in ${pids}; do     kill ${i}; done

top  M  1

>sudo nginx
>sudo nginx -s quit

监控java线程数:
ps -eLf | grep java | wc -l

监控网络客户连接数:
netstat -n | grep tcp | grep 侦听端口 | wc -l

path=/home/apache-tomcat-8.5.16/webapps/ROOT/WEB-INF/classes/ 
find $path  > list_file.txt
ls -l $path |awk '/^d/ {print $NF}' > list_dir.txt


list and kill process listening to the port 5000 
kill -9 $(lsof -t -i:5000)

你可能感兴趣的:(linux)