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.

4 Answers 4


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

  • The config file name has recently change, now use "locate mongod.conf" (no more "b") May 21, 2016 at 21:49
  • Doesn't work for me. Locate hasn't any output.
    – OddDev
    Sep 7, 2017 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, 2017 at 14:59

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


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

  • 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, 2018 at 3:06

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'
  • Have you looked at locate's manpage? It supports both wildcards and regular expressions.
    – muru
    May 22, 2016 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, 2016 at 17:00
  • locate '*mongo*.conf', or simply: locate mongo.
    – muru
    May 22, 2016 at 17:03
  • This is also good answer, not every developer has sudo permission to run sudo updatedb
    – Watt
    Jun 22, 2017 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.