Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does linux view the current shell category

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 the current shell categories in linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to check the current shell categories by linux".

1. View the types of shell used in the current process in real time: recommended

The code is as follows:

Ps | grep $$| awk'{print $4}'

(note: $$represents the process number of shell)

2. The most commonly used command to view shell, but it cannot reflect the current shell in real time.

The code is as follows:

$echo $SHELL

3. More concise, but not all shell supports it

The code is as follows:

$echo $0

4. Matching search of shell in environment variables

The code is as follows:

Env | grep SHELL

5. Matching search of shell in password file

The code is as follows:

Cat / etc/passwd | grep muye

6. When using ps-ef

The code is as follows:

$ps-ef | grep $$| grep-v grep | grep-v ps

Note: grep-v means reverse, as follows:

The code is as follows:

Muye@bupt:~$ ps-ef | grep $$

Muye 4750 4745 0 15:47 pts/1 00:00:00 bash

Muye 5331 4750 0 16:51 pts/1 00:00:00 ps-ef

Muye 5332 4750 0 16:51 pts/1 00:00:00 grep-color=auto 4750

Get rid of the last two

At this point, I believe you have a deeper understanding of "how to view the current shell types of linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report