...
cat /etc/os-release
For Debian and Ubuntu:
Debian and Ubuntu - Process for Upgrading MongoDB 4.2 Standalone to MongoDB 6.0 Standalone
For Centos and Redhat:
RedHat and CentOS - Process for Upgrading MongoDB 4.2 Standalone to MongoDB 6.0 Standalone
...