转自: https://www.cnblogs.com/zfc2201/articles/6032292.html
查看当前发行版可以使用的shell
[jack@localhost ~]$ cat /etc/shells /bin/sh /bin/bash /sbin/nologin
查看当前使用的shell
一、最常用的查看shell的命令,但不能实时反映当前shell
[jack@localhost ~]$ echo $SHELL
/bin/bash
[jack@localhost ~]$ echo $0
bash
三、环境变量中shell的匹配查找
[jack@localhost ~]$ env | grep SHELL SHELL=/bin/bash
四、口令文件中shell的匹配查找
[jack@localhost ~]$ cat /etc/passwd | grep jack
jack:x:500:500:mengfei:/home/jack:/bin/bash
五、查看当前进程
[jack@localhost ~]$ ps
PID TTY TIME CMD
3052 pts/0 00:00:00 bash
3254 pts/0 00:00:00 ps
六、先查看当前shell的pid,再定位到此shell进程
[jack@localhost ~]$ echo $$
3052
[jack@localhost ~]$ ps -ef | grep 3052
jack 3052 3047 0 11:33 pts/0 00:00:00 bash
jack 3420 3052 0 11:57 pts/0 00:00:00 ps -ef
jack 3421 3052 0 11:57 pts/0 00:00:00 grep 3052
附:一条命令即可实现:
[jack@localhost ~]$ ps -ef | grep `echo $$` | grep -v grep | grep -v ps
jack 3052 3047 0 11:33 pts/0 00:00:00 bash
七、输入一条不存的命令,查看出错的shell提示
[jack@localhost ~]$ tom bash: tom: command not found原文链接:https://www.f2er.com/bash/389008.html