How to view shell

  
in Linux system

The shell in the system is a programming language that can execute various commands. How to view the shell? The following small series will introduce you to how to view the current shell under Linux, let's get to know it.

1, real-time view shell species currently used in the process: Recommended

code is as follows:

ps |  Grep $$ |  Awk ‘{print $4}’

(Note: $$ indicates the shell process number)

2, the most commonly used command to view the shell, but can not reflect the current shell in real time

The code is as follows:

$ echo $SHELL

3, more concise, but not all shells support

The code is as follows:

$ echo $0

4, the matching search of the shell in the environment variable

The code is as follows:

env |  Grep SHELL

5, the matching search of the shell in the password file

The code is as follows:

cat /etc/passwd |  Grep muye

6. When using ps -ef

The code is as follows:

$ ps -ef |  Grep $$ |  Grep -v grep |  Grep -v ps

Note: grep -v means negation, as follows:

The code is as follows:

"a href=“mailto:muye@bupt:~$ ”"muye@bupt:~$"/a" 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< Br>

muye 5332 4750 0 16:51 pts/1 00:00:00 grep --color=auto 4750

Remove the two

The above is the view of the shell under Linux The method is introduced. If you don't know how to view the shell, you can try the method described in this article. Generally, you can use the command to view it. Do you understand?

Copyright © Windows knowledge All Rights Reserved