查找安装在Linux上的那些程序 这里有几种方法: 获取配置文件位置

1、如果程序在运行中

ps -ef | grep nginx
# ps -ef | grep nginx 
root     29514     1  0 Mar01 ?        00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 29515 29514  0 Mar01 ?        00:00:00 nginx: worker process
root     30276 28948  0 09:36 pts/1    00:00:00 grep --color=auto nginx

通常是 /usr/sbin/nginx

2、程序并没有运行

查看软件安装路径

whereis nginx

查询运行文件所在路径

which nginx

当然还有另外的查询方法

rpm包安装的,可以用rpm -qa | grep “软件或者包的名字”查询;
yum方法安装的,可以用yum list installed查找;

获取配置文件位置

通过上面的一些方法,找到了nginx可执行文件的路径,就可以通过Nginx自身的功能找到配置文件的位置了。

# /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
参考文章:https://www.cnblogs.com/qianpangzi/p/10922420.html