[cs631apue] About login sh process

Yuxi Wang ywang286 at stevens.edu
Fri Dec 13 10:01:04 EST 2019


Hello professor,

According to the slide 4 of Lecture 06,  the login shell which named “-sh” would directly fork and exec.
But when I run “ps” command, it shows like this:

USER       PID PPID PGID   SESS JOBC STAT TTY       TIME COMMAND
g_cream   1158 1363 1363 a14620    0 S    ?      0:00.01 sshd: g_cream at pts/0 (sshd)
root       811 1391  811 a14968    1 S    pts/0  0:00.04 sh
g_cream   1391 1158 1391 a14968    0 Is   pts/0  0:00.00 -sh
root      2804  811 2804 a14968    1 O+   pts/0  0:00.00 ps -ajx
g_cream     40  755   40 df3930    1 I    ttyE0  0:00.01 -sh
root        41   40   41 df3930    1 I+   ttyE0  0:00.05 sh
root       755    1  755 df3930    0 Is   ttyE0  0:00.04 login

1.It seems the login shell will fork a process named “sh”, and then this “sh” forks to run the command.
2.The shell process we used to type in the command should be the “sh” not “-sh”.

Is this right or I misunderstand some steps of this?

Thank you

Yuxi Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20191213/d6aeac53/attachment.html>


More information about the cs631apue mailing list