想查找 msgcenter-sms 运行在哪儿
$ ps aux | grep msgcenter-sms
souche 18118 0.0 1.0 1165052 44196 ? Ssl Jan14 0:01 node /home/souche/msgcenter-sms/node_modules/egg-scripts/lib/start-cluster {"title":"msgcenter-sms","baseDir":"/home/souche/msgcenter-sms","framework":"/home/souche/msgcenter-sms/node_modules/@souche/blue-windy"} --title=msgcenter-sms
souche 27554 0.0 0.0 13232 928 pts/0 S+ 23:14 0:00 grep --color=auto msgcenter-sms
这里已经给出了路径 /home/souche/msgcenter-sms/node_modules/egg-scripts/lib/start-cluster
,但这个路径其实只是启动脚本的,如果你用全局命令启动的话,那就没办法显示路径。总之拿到了 pid 为 18118
$ cd /proc/18118
/proc/18118$ ls -l cwd
lrwxrwxrwx 1 souche souche 0 Jan 15 23:14 cwd -> /home/souche/msgcenter-sms
大功告成,程序目录其实就在 /home/souche/msgcenter-sms 。