教你如何查看linux当前shell

教你如何查看linux当前shell

游戏|数码彩彩2024-06-14 7:40:34500A+A-

查看当前发行版可以使用的shell
[jack@localhost ~]$ cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin

查看当前使用的shell

一、最常用的查看shell的命令,但不能实时反映当前shell
[jack@localhost ~]$ echo $SHELL
/bin/bash

二、下面这个用法并不是所有shell都支持
[jack@localhost ~]$ echo $0
bash

三,查看系统中安装了哪些shell

cat /etc/shells

/bin/sh/bin/bash/sbin/nologin/bin/dash/bin/tcsh/bin/csh

四、口令文件中shell的匹配查找
[jack@localhost ~]$ cat /etc/passwd | grep jack

jack:x:500:500:mengfei:/home/jack:/bin/bash

教你如何查看linux当前shell

 

linux系统版本信息的Shell命令

几种查看Linux版本信息的方法:

  1. uname -a

  2. cat /proc/version

  3. cat /etc/issue

  4. lsb_release -a

  详解 lsb_release -a

  登录到服务器执行 lsb_release -a ,即可列出所有版本信息,例如:

  1. [root@3.5.5Biz-46 ~]# lsb_release -a

  2. LSB Version: 1.3

  3. Distributor ID: RedHatEnterpriseAS

  4. Description: Red Hat Enterprise Linux AS release 4 (Nahant Update 1)

  5. Release: 4

  6. Codename: NahantUpdate1

  7. [root@3.5.5Biz-46 ~]#

  这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。

 


查看redhat的release版本


dhat的release版本#more /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
#more /etc/issue
# more /proc/version
查看CPU信息
#grep "model name" /proc/cpuinfo
#more /proc/cpuinfo
查看CPU位数(32 or 64)
#getconf LONG_BIT
查看内存信息 
#more /proc/meminfo 
#grep MemTotal /proc/meminfo 
查看libc、gcc版本 
#ldd /sbin/mii-tool 
#rpm -qa | grep glibc 
#gcc –v
查看Ubuntu版本
方法一
在终端中执行下列指令:
cat /etc/issue
可以查看当前正在运行的 Ubuntu 的版本号。其输出结果类似下面的内容:
Ubuntu 7.04 n l
方法二
使用 lsb_release 命令也可以查看 Ubuntu 的版本号,与方法一相比,内容更为详细。执行指令如下

sudo lsb_release -a
将输出结果:
Distributor ID: Ubuntu
Description: Ubuntu 7.04
Release: 7.04
Codename: feisty
查看freebsd版本
uname -a

linux 查看和切换shell

1、使用chsh可以在shell之间进行切换

alloy@raspberrypi:~/linuxshell/chapter9$ chsh

Password:

Changing the login shell for alloy

Enter the new value, or press ENTER for the default

Login Shell [/bin/bash]: /bin/dash

alloy@raspberrypi:~/linuxshell/chapter9$ echo $SHELL

/bin/bash

总结

想一起学习的可以关注+私信,可送相关资料内容包括:C/C++,Linux,Nginx,ZeroMQ,MySQL,redis,fastdfs,MongoDB,ZK,ffmpeg流媒体,CDN,P2P,K8S,Docker,Golang,TCP/IP,协程,嵌入式,ARM,DPDK等等。。。

点击这里复制本文地址 版权声明:本文内容由网友提供,该文观点仅代表作者本人。本站(https://www.angyang.net.cn)仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

昂扬百科 © All Rights Reserved.  渝ICP备2023000803号-3网赚杂谈