What Linux Terminal Am I Currently Using?
When we run Linux on a Docker container, we may not know what terminal application or shell currently runs. If we want to find out, we can run two commands to get an answer.
The first command tty stands for teletypewriter and shows us the name of the terminal device linked to our standard input. That allows us to identify which terminal session we are on, should multiple people use it.
This shows us that we run on /dev/pts/0. This information helps us to check that we look at the right data in the next step.
The second command we need is ps. It stands for process status and shows us what processes run on our Linux machine. With the option -p we can filter for a specific process id and the special shorthand $$ gives us the current process id. When we combine that, we get the process information of our current terminal:
We can see that our terminal (pts/0) runs sh, the Bourne shell.
When we switch to the Bash shell, we should see a different output:
Should the -p option not be available, we can check the correct flag in the manual page that we can get with man ps.