1. Real-time view of the shell types used in the current process: recommended
The code is as follows:
PS | grep $$ | awk ' {print $4} '
(Note: $$ indicates the shell's process number)
2. The most common command to view the shell, but cannot reflect the current shell in real time
Copy CodeThe code is as follows:
$ echo $SHELL
3, more concise, but not all shell support
Copy CodeThe code is as follows:
$ echo $
4. The Shell matching search in environment variables
Copy CodeThe code is as follows:
env | grep SHELL
5, the password file in the shell matching search
Copy CodeThe code is as follows:
cat/etc/passwd | grep Muye
6. When using Ps-ef
Copy CodeThe code is as follows:
$ PS-EF | grep $$ | Grep-v grep | Grep-v PS
Note: Grep-v is reversed, as follows:
Copy CodeThe code is as follows:
Ps-ef | grep $$
Muye 4750 4745 0 15:47 pts/1 00:00:00 bash
Muye 5331 4750 0 16:51 pts/1 00:00:00 ps-ef
Muye 5332 4750 0 16:51 pts/1 00:00:00 grep--color=auto 4750
Remove the latter two
How Linux looks at the current shell