Getting the (parent) process executing a command in a Linux shell

Consult how to check the program that performs this process?

for example

the following commands (ps -ef) will look at the sendmail process if this process is running

  ps –ef | grep sendmail
  root     9558 9544 019:05?      00:00:00/usr/sbin/sendmail-FCronDaemon-i-odi-oem-oi-t

what i want to find is a script that execute binary / usr / sbin / sendmail

so my question is what flags do I need to add to the ps -ef syntax to get full information from ps -ef, enable which program starts the process

Is it possible?

  • Example and Note

If /etc/rc3.d/sendmail run the binary / usr / sbin / sendmail

Then I expect to see /etc/rc3.d/sendmail PATH from the ps -ef ....... command

+4
1

- .

pstree -a:

[~]# pstree -a
init
  ├─atd
  ├─atop -a -w /var/log/atop.log 600
  ├─cron
  ├─dbus-daemon --system --fork --activation=upstart
  ├─getty -8 38400 tty4
  │   ├─sshd
  │   └─sshd
  │       └─zsh
  │           └─pstree -a
  ├─udevd --daemon
  │   ├─udevd --daemon
  │   └─udevd --daemon
  ├─upstart-socket- --daemon
  ├─upstart-udev-br --daemon

, zsh (my shell), pstree. zsh sshd.

ps -AF:

root     10006   649  0 22329  3944   0 12:48 ?        00:00:00 sshd: root@pts/2
root     10041 10006  0 10355  5276   0 12:48 pts/2    00:00:00 -zsh
root     16465 10041  0  4538  1220   0 12:52 pts/2    00:00:00 ps -AF

- , . , ps -AF 10041. init ( 1), .

, /etc/rc3.d/sendmail, , , /usr/sbin/sendmail, -, /etc/rc3.d.

+2

All Articles