In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to check what kind of shell is used under Linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to check which kind of shell is used under Linux".
View the shell available for the current release
The code is as follows:
[root@localhost ~] $cat / etc/shells
/ bin/sh
/ bin/bash
/ sbin/nologin
View the shell method currently in use
First, the most commonly used command to view shell, but can not reflect the current shell in real time
The code is as follows:
[root@localhost ~] $echo $SHELL
/ bin/bash
The following usage is not supported by all shell
The code is as follows:
[root@localhost ~] $echo $0
-bash
Third, the matching search of shell in environment variables
The code is as follows:
[root@localhost ~] $env | grep SHELL
SHELL=/bin/bash
4. Matching search of shell in password file
The code is as follows:
[root@localhost ~] $cat / etc/passwd | grep root
Root:x:0:0:root:/root:/bin/bash
View the 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
6. Check the pid of the current shell before navigating to the shell process
The 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
Root 2030 1862 0 02:07 pts/0 00:00:00 grep 1862
7. Enter a command that does not exist to view the shell prompt for errors
The code is as follows:
[root@localhost ~] $asdf
Bash: asdf: command not found
Attachment: it can be realized with one command:
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
Thank you for your reading, the above is the content of "how to check which kind of shell is used under Linux". After the study of this article, I believe you have a deeper understanding of how to check which kind of shell is used under Linux. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.