日期:2014-05-16  浏览次数:20683 次

30 查看当前Linux系统中安装的shell及其版本

shell俗称壳(用来区别于核),是指“提供使用者使用界面”的软件(命令解析器),其接收用户命令,然后调用相应的应用程序。同时shell又是一种程序设计语言,作为命令语言,它交互式解释和执行用户输入的命令或者自动地解释和执行预先设定好的一连串的命令;作为程序设计语言,它定义了各种变量和参数,并提供了许多在高级语言中才具有的控制结构,包括循环和分支。

1、可以通过查看/etc/shells中的对应文件得知当前Linux系统中安装的shell

alloy@raspberrypi:~$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash

也可以查看 /bin/*sh 来确定对应的shell名称

alloy@raspberrypi:~$ ls /bin/*sh
/bin/bash  /bin/dash  /bin/rbash  /bin/sh


2、可以使用bash -version 命令来查看当前shell的版本号

alloy@raspberrypi:~$ bash -version
GNU bash, version 4.2.37(1)-release (arm-unknown-linux-gnueabihf)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

以上是树莓派的raspbian的默认shell

alloy@alloy:~$ bash -version
GNU bash, 版本 4.2.25(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
许可证 GPLv3+: GNU GPL 许可证版本3或者更高 <http://gnu.org/licenses/gpl.html>

这是自由软件,您可以自由地更改和重新发布。
在法律允许的范围内没有担保.

以上是ubuntu 12.04的默认shell