初教者怎样检察Linux中的shell指北

相关游戏 相关文章 发表评论字体大小:【 | |

作者:佚名 2019-12-31 来源:本站整理    浏览:7     评论:0 条

  不少人皆念知叙原机的Linux体系运用的是哪一种shell,上面小编便学您若何查看Linux体系外运用的shell的要领,一同去理解高吧。

初教者怎样检察Linux中的shell指北

  查看以后刊行版能够运用的shell

  代码以下:

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

  /bin/sh

  /bin/bash

  /sbin/nologin

  查看以后运用的shell要领

  1、最罕用的查看shell的号令,但不克不及真时反映以后shell

  代码以下:

  [root@localhost ~]$ echo $SHELL

  /bin/bash

  2、上面那个用法其实不是一切shell皆撑持

  代码以下:

  [root@localhost ~]$ echo $0

  -bash

  3、环境变质外shell的婚配查找

  代码代码以下:

  [root@localhost ~]$ env | grep SHELL

  SHELL=/bin/bash

  四、心令文件外shell的婚配查找

  代码以下:

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

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

  5、查看以后入程

  代码以下:

  [root@localhost ~]$ ps

  PID TTY TIME CMD

  3052 pts/0 00:00:00 bash

  3254 pts/0 00:00:00 ps

  6、先查看以后shell的pid,再定位到此shell入程

  代码以下:

  [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

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

  7、输进一条没有存的号令,查看犯错的shell提示

  代码以下:

  [root@localhost ~]$ asdf

  bash: asdf: co妹妹and not found

  附:一条号令便可真现:

  代码以下:

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

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

  下面便是Linux高查看运用的是哪一种shell的要领的引见了,若是您没有知叙您的电脑运用的是哪一种shell,没关系尝尝下面引见的要领吧。

这些是你想要的吗?

相关游戏

网友评论

评论需审核后才能显示