Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Dec 252010
 

How do I know if I am running a shell inside another shell?

Answer:

We can enter another a shell from a current shell, e.g. enter sh from a bash. To show the current "shell stack", you can use the pstree command.

# pstree -p | grep bash

    |-sshd(791)---sshd(29118)---sshd(29171)---bash(29172)---sh(29428)-+-grep(29430)

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>