start mongodb linux command line code example

Example 1: start mongodb service ubuntu

sudo systemctl start mongod
sudo systemctl stop mongod

Example 2: linux start mongodb

sudo systemctl start mongod

Example 3: ubuntu start mongodb

sudo mongod --fork --config /etc/mongod.conf

Example 4: start mongodb in terminal

Start a terminal for your mongo server
Go to <mongodb-install-directory>/bin directory
Run the command./mongod
Start a terminal for your mongo shell
Go to <mongodb-install-directory>/bin directory
Run the command (make sure you put the name of the database)./mongo test