I have installed mongoDB in my centOS server by using the below command:

1) Create a /etc/yum.repos.d/mongodb-org-3.4.repo file and insert:

name=MongoDB Repository

2) sudo yum install -y mongodb-org

When I type mongo -version, I get MongoDB shell version v3.4.6

But I coudn't locate the bin directory in my machine. Where is the default directory of mongodb located on linux and how to find it? Any help is appreciated. Thanks


You can use which mongo to get the path to the binary. From the man: which - shows the full path of (shell) commands.

Another option is to check where the RPM was installed to rpm -ql mongo and for additional info of the RPM rpm -qi mongo

To get the name of the package, in case its not mongo, use rpm -qa | grep mongo to look for RPMs containing the name mongo

  • Thanks for your reply. When I use which mongo command, I get /usr/bin/mongo. This is a binary file.There is no folder inside of /usr/bin/mongo. I would like to find out where the bin folder is located. (mongo/bin) – Rose Jul 31 '17 at 17:31
  • I added another option using rpm. Hope this is what you were looking for – Chen A. Jul 31 '17 at 17:32

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.