简体   繁体   中英

Gnome Terminal PID

How can I get the PID of a TERMINAL running a process with given PID? For example, I open a new terminal and run it a process, say ". / dbserver", then I have the PID of the process using pidof dbServer , so I want the PID of the terminal that is running dbserver. bash.

The output of ps -f includes the parent PID of each process. You could also use -o ppid along with whichever other fields you are interested in.

考虑到终端是该进程的父进程,请参见此处: https//superuser.com/questions/150117/how-to-get-parent-pid-of-a-given-process-in-gnu-linux-from -命令行

ps -p `pidof dbserver` -o ppid=

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM