sudo mongod code example Example: how to restart mongodb server in ubuntu sudo systemctl restart mongodb # it will restarts running mongodb server