Today I Learned

A Hashrocket project

Am I connected to a terminal via ssh?

When connecting to another computer via ssh the computer will have some environment variables that are not set otherwise. You can examine the environment variables with SSH in the name with:

> printenv | grep SSH

And in both linux and macos you'll see an environment variable:


The first ip address and corresponding port represents the ip address if one exists and the second is the machine you are currently ssh'd into.