how to check port on which mongodb is running using terminal code example Example: how to know on which port my mongodb server is running sudo lsof -iTCP -sTCP:LISTEN | grep mongo