9

I tried to find this info everywhere and couldn't find it. I already change mongodb.conf so I forget where the original directory is.

6

When you are searching a file in your filesystem while you are running Ubuntu a very easy way to find it is to do the following:

  1. Update the database with your files (may be a bit slow, depending on when it run the last time automatically from your system):

    sudo updatedb
    
  2. Search for the corresponding file (super quick):

    locate mongodb.conf
    

The config file name has recently change, now use locate mongod.conf (no more "b") (or just locate '*mongo*.conf', if you aren't sure).

Note: In the latest mongodb versions, the configuration file has been renamed to mongod.conf

3
  • The config file name has recently change, now use "locate mongod.conf" (no more "b") May 21 '16 at 21:49
  • Doesn't work for me. Locate hasn't any output.
    – OddDev
    Sep 7 '17 at 7:00
  • 1
    @OddDev the file has been renamed to mongod.conf. In my installation it's placed at /etc/mongod.conf
    – hytromo
    Sep 7 '17 at 14:59
2

I'm not sure for amazon ec2 exactly but on my machine it is located at /var/lib/mongodb

0
-1

You can find MongoDB configuration: locate 'mongo.conf' Also this is the MongoDB resource: https://docs.mongodb.com/manual/reference/configuration-options/

1
  • 1
    Welcome to Ask Ubuntu! Welcome to Ask Ubuntu! Please add appropriate citations when your answer incorporates a part of another answer. For discussion about why see this meta question. If your answer would not stand on its own consider: suggesting an edit, or expanding your answer.
    – J. Starnes
    Jan 13 '18 at 3:06
-1

IMO finding files with locate isn't the best approach, since you have to know the identical name of the file you're searching

Try instead

find / -name 'mondo*.conf'
4
  • Have you looked at locate's manpage? It supports both wildcards and regular expressions.
    – muru
    May 22 '16 at 16:41
  • You are right, I haven't - yet you could've gave an example of its usage in the same scenario. May 22 '16 at 17:00
  • locate '*mongo*.conf', or simply: locate mongo.
    – muru
    May 22 '16 at 17:03
  • This is also good answer, not every developer has sudo permission to run sudo updatedb
    – Watt
    Jun 22 '17 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.