Files
obsidian_note/技术探究/Linux/进程.md
2025-12-04 09:12:56 +08:00

39 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
```
根据进程号查看运行路径 例子13129
[root@ict-dmp2-2859 puaiuc]# ll /proc/13129
dr-xr-xr-x. 2 root root 0 1月 25 17:35 attr
-rw-r--r--. 1 root root 0 1月 25 17:38 autogroup
-r--------. 1 root root 0 1月 25 17:38 auxv
-r--r--r--. 1 root root 0 1月 25 17:38 cgroup
--w-------. 1 root root 0 1月 25 17:38 clear_refs
-r--r--r--. 1 root root 0 11月 15 14:11 cmdline
-rw-r--r--. 1 root root 0 1月 25 17:38 comm
-rw-r--r--. 1 root root 0 1月 25 17:38 coredump_filter
-r--r--r--. 1 root root 0 1月 25 17:38 cpuset
lrwxrwxrwx. 1 root root 0 1月 25 17:38 cwd -> /usr/local/nginx
-r--------. 1 root root 0 11月 15 14:11 environ
lrwxrwxrwx. 1 root root 0 11月 15 14:11 exe -> /usr/local/nginx/sbin/nginx
```
容器查看
```
docker exec -it bash
docker ps -a
```
shell 启动脚本 启停
```
pid=`ps -ef|grep xxxxxxxxx|grep -v grep|awk '{print $2}'`
echo $pid
kill -9 $pid
./xxxx >> log.mock 2>&1&
echo '-------'
pid=`ps -ef|grep xxxxxxxxx|grep -v grep|awk '{print $2}'`
echo $pid
```
## 问题排查 进程 cpu 内存 占用
```
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
```