Here is how you can find out when logged in through SSH:
This generally won’t tell you as much as you’d like.
This will generally tell you more than you’d like.
Once you know that you are running Red Hat for example, you can get to the point with:
Or on Debian: