linux查找文件利器

查找文件

比如:找nginx.conf配置文件

locate nginx.conf
/usr/local/etc/nginx/nginx.conf
/usr/local/etc/nginx/nginx.conf.default

如果提示  locate  命令找不到  就安装下 

安装:yum  -y install mlocate

安装完再尝试用locate定位内容,发现依然不好使,报了新的错误:
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory

更新库:updatedb

查找进程相关

ps aux|grep nginx

ps -ef|grep nginx

2者没有太大的差别。一个样其实

查找nginx的启动的时候的配置文件

/usr/local/opt/nginx/bin/nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

测试可知,nginx的配置文件路径为:/usr/local/etc/nginx/nginx.conf 且调用有效。

原文地址:https://www.cnblogs.com/coder-lzh/p/11278644.html