How Linux looks at the current shell

Source: Internet
Author: User

1. Real-time view of the shell types used in the current process: recommended
The code is as follows:

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


(Note: $$ indicates the shell's process number)

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

Copy CodeThe code is as follows:
$ echo $SHELL

3, more concise, but not all shell support

Copy CodeThe code is as follows:
$ echo $

4. The Shell matching search in environment variables

Copy CodeThe code is as follows:
env | grep SHELL

5, the password file in the shell matching search

Copy CodeThe code is as follows:
cat/etc/passwd | grep Muye

6. When using Ps-ef

Copy CodeThe code is as follows:
$ PS-EF | grep $$ | Grep-v grep | Grep-v PS

Note: Grep-v is reversed, as follows:

Copy CodeThe code is as follows:
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

Remove the latter two

How Linux looks at the current shell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.