Linxu下如何查看一个服务/应用的所在位置和配置位置(以nginx为例)
有时候我们需要查看某个程序的配置和运行目录
以nginx为例
1、看出进程ID - PID
[root@www ~]# ps -C nginx
PID TTY TIME CMD
1113 ? 00:00:00 nginx
1116 ? 00:00:03 nginx
1124 ? 00:00:03 nginx
2、通过PID查看应用所在目录
[root@www ~]# ll /proc/1113/exe lrwxrwxrwx. 1 root root 0 Oct 30 20:41 /proc/1113/exe -> /usr/sbin/nginx
3、通过 -t 命令找到配置
[root@www ~]# /usr/sbin/nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
----EDN----