Beginners how to view the shell guide in Linux

  

Many people want to know which shell is used in the Linux system of this machine, the following small series teaches you how to view the shell method used in the Linux system, together to understand Let's go.

can be used to view the current release of the shell

code is as follows:

[root @ localhost ~] $ cat /etc /shells

/bin/sh

/bin/bash

/sbin/nologin

View the currently used shell methods

First, the most commonly used view shell Command, but can't reflect the current shell

code in real time:

[root@localhost ~]$ echo $SHELL

/bin/bash

The following usage is not supported by all shells.

The code is as follows:

[root@localhost ~]$ echo $0

-bash

The matching lookup of the shell in the environment variable

The code is as follows:

[root@localhost ~]$ env |  Grep SHELL

SHELL=/bin/bash

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

The code is as follows:

[root@localhost ~] $ cat /etc/passwd |  Grep root

root:x:0:0:root:/root:/bin/bash

V. View current process

The code is as follows:

[root@localhost ~]$ ps

PID TTY TIME CMD

3052 pts/0 00:00:00 bash

3254 pts/0 00:00:00 Ps

Six, first look at the current shell pid, and then locate the shell process

Code is as follows:

[root@localhost ~]$ echo $$

1862

[root@localhost ~]$ ps -ef |  Grep 1862

root 1862 1860 0 01:50 pts/0 00:00:00 -bash

root 2029 1862 0 02:07 pts/0 00:00:00 ps -ef< Br>

root 2030 1862 0 02:07 pts/0 00:00:00 grep 1862

7. Enter a command that does not exist, check the shell prompt for error

:

[root@localhost ~]$ asdf

bash: asdf: command not found

Attached: A command can be implemented:

The code is as follows :

[root@localhost ~]$ ps -ef |  Grep `echo $$` |  Grep -v grep |  Grep -v ps

root 1862 1860 0 01:50 pts/0 00:00:00 -bash

The above is an introduction to the method of using which shell to use under Linux. If you don't know which shell your computer uses, try the methods described above.

Copyright © Windows knowledge All Rights Reserved